Skip to content

Commit

Permalink
Merge pull request umijs#642 from paranoidjk/fix-eslintrc
Browse files Browse the repository at this point in the history
fix: af-webpack should resolve eslintrc according to APP_ROOT
  • Loading branch information
sorrycc authored Jun 20, 2018
2 parents 2a34948 + 55ca5cb commit 743faa0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/af-webpack/src/getConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,17 +336,18 @@ export default function getConfig(opts = {}) {
}

// 读用户的 eslintrc
if (existsSync(resolve('.eslintrc'))) {
const userEslintRulePath = resolve(opts.cwd, '.eslintrc');
if (existsSync(userEslintRulePath)) {
try {
const userRc = readRc(resolve('.eslintrc'));
const userRc = readRc(userEslintRulePath);
debug(`userRc: ${JSON.stringify(userRc)}`);
if (userRc.extends) {
debug(`use user's .eslintrc: ${resolve('.eslintrc')}`);
debug(`use user's .eslintrc: ${userEslintRulePath}`);
eslintOptions.useEslintrc = true;
eslintOptions.baseConfig = false;
eslintOptions.ignore = true;
} else {
debug(`extend with user's .eslintrc: ${resolve('.eslintrc')}`);
debug(`extend with user's .eslintrc: ${userEslintRulePath}`);
eslintOptions.baseConfig = {
...eslintOptions.baseConfig,
...userRc,
Expand Down

0 comments on commit 743faa0

Please sign in to comment.