From 706da6e4f4ac621c7883a8841c7752f44a90d199 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2019 07:41:43 +0100 Subject: [PATCH] Update dependency eslint-loader to v3 (#1455) * 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. --- packages/airbnb-base/test/airbnb_test.js | 4 ++-- packages/airbnb/package.json | 2 +- packages/airbnb/test/airbnb_test.js | 4 ++-- packages/eslint/index.js | 10 --------- packages/eslint/package.json | 2 +- packages/eslint/test/middleware_test.js | 9 ++++---- packages/standardjs/test/standardjs_test.js | 4 ++-- yarn.lock | 23 ++++++++++----------- 8 files changed, 23 insertions(+), 35 deletions(-) diff --git a/packages/airbnb-base/test/airbnb_test.js b/packages/airbnb-base/test/airbnb_test.js index 66ac819b3..c0e52614c 100644 --- a/packages/airbnb-base/test/airbnb_test.js +++ b/packages/airbnb-base/test/airbnb_test.js @@ -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, }); }); @@ -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, }); diff --git a/packages/airbnb/package.json b/packages/airbnb/package.json index ee5317afa..9b2bb213a 100644 --- a/packages/airbnb/package.json +++ b/packages/airbnb/package.json @@ -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", diff --git a/packages/airbnb/test/airbnb_test.js b/packages/airbnb/test/airbnb_test.js index 9a2513e21..2b97e06f7 100644 --- a/packages/airbnb/test/airbnb_test.js +++ b/packages/airbnb/test/airbnb_test.js @@ -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, }); }); @@ -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, }); diff --git a/packages/eslint/index.js b/packages/eslint/index.js index c84acec7a..1fd2a0c42 100644 --- a/packages/eslint/index.js +++ b/packages/eslint/index.js @@ -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()) diff --git a/packages/eslint/package.json b/packages/eslint/package.json index 21a7045fc..f1533311b 100644 --- a/packages/eslint/package.json +++ b/packages/eslint/package.json @@ -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" }, diff --git a/packages/eslint/test/middleware_test.js b/packages/eslint/test/middleware_test.js index 24a7396da..79e84bacf 100644 --- a/packages/eslint/test/middleware_test.js +++ b/packages/eslint/test/middleware_test.js @@ -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 => { @@ -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, }); @@ -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: { @@ -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, }); }); diff --git a/packages/standardjs/test/standardjs_test.js b/packages/standardjs/test/standardjs_test.js index 3e0550a17..f97df5389 100644 --- a/packages/standardjs/test/standardjs_test.js +++ b/packages/standardjs/test/standardjs_test.js @@ -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, }); }); @@ -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, }); diff --git a/yarn.lock b/yarn.lock index 00e2c023f..19dedb66a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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== @@ -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== @@ -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==