From e9e6918df6eeefc56f0deab9f7710de67f7c97d3 Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Sat, 16 Nov 2019 19:21:00 -0500 Subject: [PATCH 1/3] Do not run eslint/* tests in Node v6 --- jest.config.js | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 49 ------------------------------------------------- 2 files changed, 50 insertions(+), 49 deletions(-) create mode 100644 jest.config.js diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 0000000000..1a96c96326 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,50 @@ +module.exports = { + collectCoverageFrom: [ + "packages/*/src/**/*.mjs", + "packages/*/src/**/*.js", + "codemods/*/src/**/*.mjs", + "codemods/*/src/**/*.js", + "eslint/*/src/**/*.mjs", + "eslint/*/src/**/*.js", + ], + // The eslint/* packages use ESLint v6, which has dropped support for Node v6. + testRegex: `./(packages|codemods${ + /^v6./u.test(process.version) ? "" : "|eslint" + })/[^/]+/test/.+\\.m?js$`, + testPathIgnorePatterns: [ + "/node_modules/", + "/test/fixtures/", + "/test/debug-fixtures/", + "/babel-parser/test/expressions/", + "/test/tmp/", + "/test/__data__/", + "/test/helpers/", + "/test/warning\\.js", + "/build/", + "_browser\\.js", + ], + testEnvironment: "node", + setupFilesAfterEnv: ["/test/testSetupFile.js"], + transformIgnorePatterns: [ + "/node_modules/", + "/packages/babel-standalone/babel(\\.min)?\\.js", + "/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js", + "/test/(fixtures|tmp|__data__)/", + "/(packages|codemods|eslint)/[^/]+/lib/", + ], + coveragePathIgnorePatterns: [ + "/node_modules/", + "/packages/babel-standalone/babel(\\.min)?\\.js", + "/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js", + "/test/(fixtures|tmp|__data__)/", + ], + modulePathIgnorePatterns: [ + "/test/fixtures/", + "/test/tmp/", + "/test/__data__/", + "/build/", + ], + moduleNameMapper: { + "^@babel/([a-zA-Z0-9_-]+)$": "/packages/babel-$1/", + }, +}; diff --git a/package.json b/package.json index 15ad863a8f..5da887e649 100644 --- a/package.json +++ b/package.json @@ -89,54 +89,5 @@ "hooks": { "pre-commit": "lint-staged" } - }, - "jest": { - "collectCoverageFrom": [ - "packages/*/src/**/*.mjs", - "packages/*/src/**/*.js", - "codemods/*/src/**/*.mjs", - "codemods/*/src/**/*.js", - "eslint/*/src/**/*.mjs", - "eslint/*/src/**/*.js" - ], - "testRegex": "./(packages|codemods|eslint)/[^/]+/test/.+\\.m?js$", - "testPathIgnorePatterns": [ - "/node_modules/", - "/test/fixtures/", - "/test/debug-fixtures/", - "/babel-parser/test/expressions/", - "/test/tmp/", - "/test/__data__/", - "/test/helpers/", - "/test/warning\\.js", - "/build/", - "_browser\\.js" - ], - "testEnvironment": "node", - "setupFilesAfterEnv": [ - "/test/testSetupFile.js" - ], - "transformIgnorePatterns": [ - "/node_modules/", - "/packages/babel-standalone/babel(\\.min)?\\.js", - "/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js", - "/test/(fixtures|tmp|__data__)/", - "/(packages|codemods)/[^/]+/lib/" - ], - "coveragePathIgnorePatterns": [ - "/node_modules/", - "/packages/babel-standalone/babel(\\.min)?\\.js", - "/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js", - "/test/(fixtures|tmp|__data__)/" - ], - "modulePathIgnorePatterns": [ - "/test/fixtures/", - "/test/tmp/", - "/test/__data__/", - "/build/" - ], - "moduleNameMapper": { - "^@babel/([a-zA-Z0-9_-]+)$": "/packages/babel-$1/" - } } } From db2b6018864f308816205fef009f8793ec295fe5 Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Sun, 17 Nov 2019 18:34:47 -0500 Subject: [PATCH 2/3] Add TODO comment --- jest.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/jest.config.js b/jest.config.js index 1a96c96326..6145dd3f2f 100644 --- a/jest.config.js +++ b/jest.config.js @@ -8,6 +8,7 @@ module.exports = { "eslint/*/src/**/*.js", ], // The eslint/* packages use ESLint v6, which has dropped support for Node v6. + // TODO: Remove this process.version check in Babel 8. testRegex: `./(packages|codemods${ /^v6./u.test(process.version) ? "" : "|eslint" })/[^/]+/test/.+\\.m?js$`, From d18d0b6478feadf08a20c6608220bc6370ab0ecc Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Sun, 17 Nov 2019 23:31:38 -0500 Subject: [PATCH 3/3] Run Prettier --- eslint/babel-eslint-plugin/src/rules/array-bracket-spacing.js | 2 +- eslint/babel-eslint-plugin/src/rules/arrow-parens.js | 2 +- .../babel-eslint-plugin/src/rules/func-params-comma-dangle.js | 2 +- eslint/babel-eslint-plugin/src/rules/generator-star-spacing.js | 2 +- eslint/babel-eslint-plugin/src/rules/new-cap.js | 2 +- eslint/babel-eslint-plugin/src/rules/no-await-in-loop.js | 2 +- eslint/babel-eslint-plugin/src/rules/no-unused-expressions.js | 2 +- eslint/babel-eslint-plugin/src/rules/object-curly-spacing.js | 2 +- eslint/babel-eslint-plugin/src/rules/object-shorthand.js | 2 +- eslint/babel-eslint-plugin/src/rules/semi.js | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/eslint/babel-eslint-plugin/src/rules/array-bracket-spacing.js b/eslint/babel-eslint-plugin/src/rules/array-bracket-spacing.js index e7eafff0d2..59228c2078 100644 --- a/eslint/babel-eslint-plugin/src/rules/array-bracket-spacing.js +++ b/eslint/babel-eslint-plugin/src/rules/array-bracket-spacing.js @@ -37,7 +37,7 @@ module.exports = { console.log( "The babel/array-bracket-spacing rule is deprecated. Please " + - "use the built in array-bracket-spacing rule instead." + "use the built in array-bracket-spacing rule instead.", ); isWarnedForDeprecation = true; }, diff --git a/eslint/babel-eslint-plugin/src/rules/arrow-parens.js b/eslint/babel-eslint-plugin/src/rules/arrow-parens.js index 848045ff7b..cdd2581931 100644 --- a/eslint/babel-eslint-plugin/src/rules/arrow-parens.js +++ b/eslint/babel-eslint-plugin/src/rules/arrow-parens.js @@ -22,7 +22,7 @@ module.exports = { console.log( "The babel/arrow-parens rule is deprecated. Please " + - "use the built in arrow-parens rule instead." + "use the built in arrow-parens rule instead.", ); isWarnedForDeprecation = true; }, diff --git a/eslint/babel-eslint-plugin/src/rules/func-params-comma-dangle.js b/eslint/babel-eslint-plugin/src/rules/func-params-comma-dangle.js index 40bd08b3bb..d504271034 100644 --- a/eslint/babel-eslint-plugin/src/rules/func-params-comma-dangle.js +++ b/eslint/babel-eslint-plugin/src/rules/func-params-comma-dangle.js @@ -22,7 +22,7 @@ module.exports = { console.log( "The babel/func-params-comma-dangle rule is deprecated. Please " + - "use the built in comma-dangle rule instead." + "use the built in comma-dangle rule instead.", ); isWarnedForDeprecation = true; }, diff --git a/eslint/babel-eslint-plugin/src/rules/generator-star-spacing.js b/eslint/babel-eslint-plugin/src/rules/generator-star-spacing.js index 6befc25d04..8d65262b57 100644 --- a/eslint/babel-eslint-plugin/src/rules/generator-star-spacing.js +++ b/eslint/babel-eslint-plugin/src/rules/generator-star-spacing.js @@ -34,7 +34,7 @@ module.exports = { console.log( "The babel/generator-star-spacing rule is deprecated. Please " + - "use the built in generator-star-spacing rule instead." + "use the built in generator-star-spacing rule instead.", ); isWarnedForDeprecation = true; }, diff --git a/eslint/babel-eslint-plugin/src/rules/new-cap.js b/eslint/babel-eslint-plugin/src/rules/new-cap.js index 3e09bb25df..17d4049755 100644 --- a/eslint/babel-eslint-plugin/src/rules/new-cap.js +++ b/eslint/babel-eslint-plugin/src/rules/new-cap.js @@ -15,5 +15,5 @@ function isDecorator(node) { module.exports = ruleComposer.filterReports( newCapRule, - problem => !isDecorator(problem.node) + problem => !isDecorator(problem.node), ); diff --git a/eslint/babel-eslint-plugin/src/rules/no-await-in-loop.js b/eslint/babel-eslint-plugin/src/rules/no-await-in-loop.js index a46a19da88..cf984f09b3 100644 --- a/eslint/babel-eslint-plugin/src/rules/no-await-in-loop.js +++ b/eslint/babel-eslint-plugin/src/rules/no-await-in-loop.js @@ -18,7 +18,7 @@ module.exports = { console.log( "The babel/no-await-in-loop rule is deprecated. Please " + - "use the built in no-await-in-loop rule instead." + "use the built in no-await-in-loop rule instead.", ); isWarnedForDeprecation = true; }, diff --git a/eslint/babel-eslint-plugin/src/rules/no-unused-expressions.js b/eslint/babel-eslint-plugin/src/rules/no-unused-expressions.js index 81c779d3c7..6bc1db49d9 100644 --- a/eslint/babel-eslint-plugin/src/rules/no-unused-expressions.js +++ b/eslint/babel-eslint-plugin/src/rules/no-unused-expressions.js @@ -60,5 +60,5 @@ function isOptionalCallExpression(node) { module.exports = ruleComposer.filterReports( rule, problem => - !isInDoStatement(problem.node) && !isOptionalCallExpression(problem.node) + !isInDoStatement(problem.node) && !isOptionalCallExpression(problem.node), ); diff --git a/eslint/babel-eslint-plugin/src/rules/object-curly-spacing.js b/eslint/babel-eslint-plugin/src/rules/object-curly-spacing.js index d3ec196201..4b13d0bd32 100644 --- a/eslint/babel-eslint-plugin/src/rules/object-curly-spacing.js +++ b/eslint/babel-eslint-plugin/src/rules/object-curly-spacing.js @@ -23,5 +23,5 @@ module.exports = ruleComposer.filterReports( } return true; - } + }, ); diff --git a/eslint/babel-eslint-plugin/src/rules/object-shorthand.js b/eslint/babel-eslint-plugin/src/rules/object-shorthand.js index 21f41e639e..92fb8949ef 100644 --- a/eslint/babel-eslint-plugin/src/rules/object-shorthand.js +++ b/eslint/babel-eslint-plugin/src/rules/object-shorthand.js @@ -22,7 +22,7 @@ module.exports = { console.log( "The babel/object-shorthand rule is deprecated. Please " + - "use the built in object-shorthand rule instead." + "use the built in object-shorthand rule instead.", ); isWarnedForDeprecation = true; }, diff --git a/eslint/babel-eslint-plugin/src/rules/semi.js b/eslint/babel-eslint-plugin/src/rules/semi.js index 8888bf4cac..d732f42dcd 100644 --- a/eslint/babel-eslint-plugin/src/rules/semi.js +++ b/eslint/babel-eslint-plugin/src/rules/semi.js @@ -119,5 +119,5 @@ module.exports = ruleComposer.filterReports( } return true; - } + }, );