From 537db9f869c7f2781744412f3bce1e2290f66fdc Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 1 Sep 2019 15:57:53 +0000 Subject: [PATCH 1/3] Update dependency eslint-loader to v3 --- packages/eslint/package.json | 2 +- yarn.lock | 28 ++++++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) 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/yarn.lock b/yarn.lock index 00e2c023f..5094b5158 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" @@ -5447,6 +5446,11 @@ eslint-plugin-promise@^4.2.1: resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz#845fd8b2260ad8f82564c1222fce44ad71d9418a" integrity sha512-VoM09vT7bfA7D+upt+FjeBO5eHIJQBUWki1aPvB+vbNiHS3+oGIJGIeyBtKQTME6UPXXy3vV07OL1tHd3ANuDw== +eslint-plugin-react-hooks@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.7.0.tgz#6210b6d5a37205f0b92858f895a4e827020a7d04" + integrity sha512-iXTCFcOmlWvw4+TOE8CLWj6yX1GwzT0Y6cUfHHZqWnSk144VmVIRcVGtUAzrLES7C798lmvnt02C7rxaOX1HNA== + eslint-plugin-react-hooks@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-2.0.1.tgz#e898ec26a0a335af6f7b0ad1f0bedda7143ed756" @@ -8679,7 +8683,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 +9982,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 +12072,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== From 2b084d71341ed5ceac1297b31c7a69766faacc83 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Sun, 1 Sep 2019 17:25:56 +0100 Subject: [PATCH 2/3] 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. --- packages/airbnb-base/test/airbnb_test.js | 4 ++-- packages/airbnb/test/airbnb_test.js | 4 ++-- packages/eslint/index.js | 10 ---------- packages/eslint/test/middleware_test.js | 9 ++++----- packages/standardjs/test/standardjs_test.js | 4 ++-- 5 files changed, 10 insertions(+), 21 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/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/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, }); From aa1a4f17ad310ee21d00582fc2b098a3296e107e Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Sun, 1 Sep 2019 17:35:14 +0100 Subject: [PATCH 3/3] airbnb: Fix inconsistent eslint-plugin-react-hooks version Due to the landings of #1447 and #1453 racing with each other. --- packages/airbnb/package.json | 2 +- yarn.lock | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) 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/yarn.lock b/yarn.lock index 5094b5158..19dedb66a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5446,11 +5446,6 @@ eslint-plugin-promise@^4.2.1: resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz#845fd8b2260ad8f82564c1222fce44ad71d9418a" integrity sha512-VoM09vT7bfA7D+upt+FjeBO5eHIJQBUWki1aPvB+vbNiHS3+oGIJGIeyBtKQTME6UPXXy3vV07OL1tHd3ANuDw== -eslint-plugin-react-hooks@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.7.0.tgz#6210b6d5a37205f0b92858f895a4e827020a7d04" - integrity sha512-iXTCFcOmlWvw4+TOE8CLWj6yX1GwzT0Y6cUfHHZqWnSk144VmVIRcVGtUAzrLES7C798lmvnt02C7rxaOX1HNA== - eslint-plugin-react-hooks@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-2.0.1.tgz#e898ec26a0a335af6f7b0ad1f0bedda7143ed756"