Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Update dependency eslint-loader to v3 (#1455)
Browse files Browse the repository at this point in the history
* Update dependency eslint-loader to v3
* eslint: Remove custom handling of named formatters
  Since eslint-loader now natively supports being passed a `formatter` that
  is the name of an in-built ESLint formatter (rather than only supporting
  a full filepath to that formatter), so @neutrinojs/eslint does not need
  to handle this case itself.
* airbnb: Fix inconsistent eslint-plugin-react-hooks version
  Due to the landings of #1447 and #1453 racing with each other.
  • Loading branch information
renovate[bot] authored and edmorley committed Sep 2, 2019
1 parent 1f47728 commit 706da6e
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 35 deletions.
4 changes: 2 additions & 2 deletions packages/airbnb-base/test/airbnb_test.js
Expand Up @@ -122,7 +122,7 @@ test('sets defaults when no options passed', t => {
cwd: api.options.root,
emitWarning: false,
failOnError: true,
formatter: require.resolve('eslint/lib/formatters/codeframe'),
formatter: 'codeframe',
useEslintrc: false,
});
});
Expand Down Expand Up @@ -221,7 +221,7 @@ test('merges options with defaults', t => {
cwd: api.options.root,
emitWarning: false,
failOnError: true,
formatter: require.resolve('eslint/lib/formatters/codeframe'),
formatter: 'codeframe',
reportUnusedDisableDirectives: true,
useEslintrc: false,
});
Expand Down
2 changes: 1 addition & 1 deletion packages/airbnb/package.json
Expand Up @@ -29,7 +29,7 @@
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-react-hooks": "^1.7.0"
"eslint-plugin-react-hooks": "^2.0.0"
},
"peerDependencies": {
"eslint": "^5.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/airbnb/test/airbnb_test.js
Expand Up @@ -126,7 +126,7 @@ test('sets defaults when no options passed', t => {
cwd: api.options.root,
emitWarning: false,
failOnError: true,
formatter: require.resolve('eslint/lib/formatters/codeframe'),
formatter: 'codeframe',
useEslintrc: false,
});
});
Expand Down Expand Up @@ -227,7 +227,7 @@ test('merges options with defaults', t => {
cwd: api.options.root,
emitWarning: false,
failOnError: true,
formatter: require.resolve('eslint/lib/formatters/codeframe'),
formatter: 'codeframe',
reportUnusedDisableDirectives: true,
useEslintrc: false,
});
Expand Down
10 changes: 0 additions & 10 deletions packages/eslint/index.js
Expand Up @@ -163,16 +163,6 @@ module.exports = ({ test, include, exclude, eslint = {} } = {}) => {
),
};

if (typeof loaderOptions.formatter === 'string') {
try {
loaderOptions.formatter = require.resolve(
`eslint/lib/formatters/${loaderOptions.formatter}`,
);
} catch (err) {
// Pass the formatter as-is, since it may be the module name/path of an external formatter.
}
}

neutrino.config.module
.rule('lint')
.test(test || neutrino.regexFromExtensions())
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint/package.json
Expand Up @@ -24,7 +24,7 @@
},
"dependencies": {
"babel-eslint": "^10.0.2",
"eslint-loader": "^2.2.1",
"eslint-loader": "^3.0.0",
"eslint-plugin-babel": "^5.3.0",
"lodash.pick": "^4.4.0"
},
Expand Down
9 changes: 4 additions & 5 deletions packages/eslint/test/middleware_test.js
Expand Up @@ -36,14 +36,13 @@ test('instantiates with options', t => {
test('supports formatter being the name of an ESLint built-in formatter', t => {
const api = new Neutrino();
const formatter = 'compact';
const formatterPath = require.resolve(`eslint/lib/formatters/${formatter}`);
api.use(mw({ eslint: { formatter } }));

const loaderOptions = api.config.module
.rule('lint')
.use('eslint')
.get('options');
t.is(loaderOptions.formatter, formatterPath);
t.is(loaderOptions.formatter, formatter);
});

test('supports formatter being a resolved path', t => {
Expand Down Expand Up @@ -153,7 +152,7 @@ test('sets defaults when no options passed', t => {
cwd: api.options.root,
emitWarning: false,
failOnError: true,
formatter: require.resolve('eslint/lib/formatters/codeframe'),
formatter: 'codeframe',
useEslintrc: false,
});

Expand Down Expand Up @@ -276,7 +275,7 @@ test('merges options with defaults', t => {
emitWarning: false,
envs: ['jest'],
failOnError: true,
formatter: require.resolve('eslint/lib/formatters/codeframe'),
formatter: 'codeframe',
globals: ['$'],
parser: 'esprima',
parserOptions: {
Expand Down Expand Up @@ -347,7 +346,7 @@ test('sets only loader-specific defaults if useEslintrc true', t => {
cwd: api.options.root,
emitWarning: false,
failOnError: true,
formatter: require.resolve('eslint/lib/formatters/codeframe'),
formatter: 'codeframe',
useEslintrc: true,
});
});
Expand Down
4 changes: 2 additions & 2 deletions packages/standardjs/test/standardjs_test.js
Expand Up @@ -123,7 +123,7 @@ test('sets defaults when no options passed', t => {
cwd: api.options.root,
emitWarning: false,
failOnError: true,
formatter: require.resolve('eslint/lib/formatters/codeframe'),
formatter: 'codeframe',
useEslintrc: false,
});
});
Expand Down Expand Up @@ -217,7 +217,7 @@ test('merges options with defaults', t => {
cwd: api.options.root,
emitWarning: false,
failOnError: true,
formatter: require.resolve('eslint/lib/formatters/codeframe'),
formatter: 'codeframe',
reportUnusedDisableDirectives: true,
useEslintrc: false,
});
Expand Down
23 changes: 11 additions & 12 deletions yarn.lock
Expand Up @@ -5350,16 +5350,15 @@ eslint-import-resolver-node@^0.3.2:
debug "^2.6.9"
resolve "^1.5.0"

eslint-loader@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/eslint-loader/-/eslint-loader-2.2.1.tgz#28b9c12da54057af0845e2a6112701a2f6bf8337"
integrity sha512-RLgV9hoCVsMLvOxCuNjdqOrUqIj9oJg8hF44vzJaYqsAHuY9G2YAeN3joQ9nxP0p5Th9iFSIpKo+SD8KISxXRg==
eslint-loader@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/eslint-loader/-/eslint-loader-3.0.0.tgz#fb70bc2d552a674f43f07f5e6575083e565e790d"
integrity sha512-rdxyQ0i9VlhwVlR6oEzrIft8WNKYSD2/cOAJ1YVH/F76gAta7Zv1Dr5xJOUyx0fAsHB5cKNz9hwlUVLMFsQlPA==
dependencies:
loader-fs-cache "^1.0.0"
loader-utils "^1.0.2"
object-assign "^4.0.1"
object-hash "^1.1.4"
rimraf "^2.6.1"
loader-fs-cache "^1.0.2"
loader-utils "^1.2.3"
object-hash "^1.3.1"
schema-utils "^2.1.0"

eslint-module-utils@^2.4.0:
version "2.4.1"
Expand Down Expand Up @@ -8679,7 +8678,7 @@ load-json-file@^5.2.0, load-json-file@^5.3.0:
strip-bom "^3.0.0"
type-fest "^0.3.0"

loader-fs-cache@^1.0.0:
loader-fs-cache@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/loader-fs-cache/-/loader-fs-cache-1.0.2.tgz#54cedf6b727e1779fd8f01205f05f6e88706f086"
integrity sha512-70IzT/0/L+M20jUlEqZhZyArTU6VKLRTYRDAYN26g4jfzpJqjipLL3/hgYpySqI9PwsVRHHFja0LfEmsx9X2Cw==
Expand Down Expand Up @@ -9978,7 +9977,7 @@ object-copy@^0.1.0:
define-property "^0.2.5"
kind-of "^3.0.3"

object-hash@^1.1.4:
object-hash@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-1.3.1.tgz#fde452098a951cb145f039bb7d455449ddc126df"
integrity sha512-OSuu/pU4ENM9kmREg0BdNrUDIl1heYa4mBZacJc+vVWz4GtAwu7jO8s4AIt2aGRUTqxykpWzI3Oqnsm13tTMDA==
Expand Down Expand Up @@ -12068,7 +12067,7 @@ schema-utils@^1.0.0:
ajv-errors "^1.0.0"
ajv-keywords "^3.1.0"

schema-utils@^2.0.0, schema-utils@^2.0.1:
schema-utils@^2.0.0, schema-utils@^2.0.1, schema-utils@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.1.0.tgz#940363b6b1ec407800a22951bdcc23363c039393"
integrity sha512-g6SViEZAfGNrToD82ZPUjq52KUPDYc+fN5+g6Euo5mLokl/9Yx14z0Cu4RR1m55HtBXejO0sBt+qw79axN+Fiw==
Expand Down

0 comments on commit 706da6e

Please sign in to comment.