Update ESLint/Prettier config for eslint/* packages (#10724)
This commit is contained in:
parent
c37361ba2e
commit
401c9bbe83
@ -25,6 +25,7 @@ packages/babel-standalone/babel.js
|
|||||||
packages/babel-standalone/babel.min.js
|
packages/babel-standalone/babel.min.js
|
||||||
packages/babel-parser/test/expressions
|
packages/babel-parser/test/expressions
|
||||||
|
|
||||||
|
eslint/*/lib
|
||||||
eslint/*/node_modules
|
eslint/*/node_modules
|
||||||
eslint/*/test
|
eslint/*/test
|
||||||
eslint/*/tests
|
eslint/*/tests
|
||||||
|
|||||||
@ -12,7 +12,11 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
files: ["packages/*/src/**/*.js", "codemods/*/src/**/*.js"],
|
files: [
|
||||||
|
"packages/*/src/**/*.js",
|
||||||
|
"codemods/*/src/**/*.js",
|
||||||
|
"eslint/*/src/**/*.js",
|
||||||
|
],
|
||||||
rules: {
|
rules: {
|
||||||
"@babel/development/no-undefined-identifier": "error",
|
"@babel/development/no-undefined-identifier": "error",
|
||||||
"@babel/development/no-deprecated-clone": "error",
|
"@babel/development/no-deprecated-clone": "error",
|
||||||
@ -24,6 +28,7 @@ module.exports = {
|
|||||||
files: [
|
files: [
|
||||||
"packages/*/test/**/*.js",
|
"packages/*/test/**/*.js",
|
||||||
"codemods/*/test/**/*.js",
|
"codemods/*/test/**/*.js",
|
||||||
|
"eslint/*/test/**/*.js",
|
||||||
"packages/babel-helper-transform-fixture-test-runner/src/helpers.js",
|
"packages/babel-helper-transform-fixture-test-runner/src/helpers.js",
|
||||||
"test/**/*.js",
|
"test/**/*.js",
|
||||||
],
|
],
|
||||||
|
|||||||
@ -13,10 +13,12 @@
|
|||||||
"**/codemods/*/src/**/*.js",
|
"**/codemods/*/src/**/*.js",
|
||||||
"**/codemods/*/test/**/*.js",
|
"**/codemods/*/test/**/*.js",
|
||||||
"**/packages/*/src/**/*.js",
|
"**/packages/*/src/**/*.js",
|
||||||
"**/packages/*/test/**/*.js"
|
"**/packages/*/test/**/*.js",
|
||||||
|
"**/eslint/*/src/**/*.js",
|
||||||
|
"**/eslint/*/test/**/*.js"
|
||||||
],
|
],
|
||||||
"parser": "babylon",
|
|
||||||
"options": {
|
"options": {
|
||||||
|
"parser": "babel",
|
||||||
"trailingComma": "all"
|
"trailingComma": "all"
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
|
|||||||
@ -1,2 +0,0 @@
|
|||||||
!.*.js
|
|
||||||
test/fixtures
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
root: true,
|
|
||||||
extends: "babel",
|
|
||||||
plugins: ["prettier"],
|
|
||||||
rules: {
|
|
||||||
"max-len": "off",
|
|
||||||
strict: "error",
|
|
||||||
"prettier/prettier": "error",
|
|
||||||
},
|
|
||||||
env: {
|
|
||||||
node: true,
|
|
||||||
},
|
|
||||||
parserOptions: {
|
|
||||||
sourceType: "script",
|
|
||||||
},
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
files: ["test/**/*"],
|
|
||||||
env: {
|
|
||||||
mocha: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
@ -94,7 +94,7 @@ class Referencer extends OriginalReferencer {
|
|||||||
// Flow super types.
|
// Flow super types.
|
||||||
this._visitTypeAnnotation(node.implements);
|
this._visitTypeAnnotation(node.implements);
|
||||||
this._visitTypeAnnotation(
|
this._visitTypeAnnotation(
|
||||||
node.superTypeParameters && node.superTypeParameters.params
|
node.superTypeParameters && node.superTypeParameters.params,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Basic.
|
// Basic.
|
||||||
@ -205,7 +205,7 @@ class Referencer extends OriginalReferencer {
|
|||||||
_createScopeVariable(node, name) {
|
_createScopeVariable(node, name) {
|
||||||
this.currentScope().variableScope.__define(
|
this.currentScope().variableScope.__define(
|
||||||
name,
|
name,
|
||||||
new Definition("Variable", name, node, null, null, null)
|
new Definition("Variable", name, node, null, null, null),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ class Referencer extends OriginalReferencer {
|
|||||||
"type-parameters",
|
"type-parameters",
|
||||||
parentScope,
|
parentScope,
|
||||||
node,
|
node,
|
||||||
false
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.scopeManager.__nestScope(scope);
|
this.scopeManager.__nestScope(scope);
|
||||||
|
|||||||
@ -9,7 +9,7 @@ const SUPPORTED_BABEL_VERSION_RANGE =
|
|||||||
packageJson.peerDependencies["@babel/core"];
|
packageJson.peerDependencies["@babel/core"];
|
||||||
const IS_RUNNING_SUPPORTED_VERSION = semver.satisfies(
|
const IS_RUNNING_SUPPORTED_VERSION = semver.satisfies(
|
||||||
CURRENT_BABEL_VERSION,
|
CURRENT_BABEL_VERSION,
|
||||||
SUPPORTED_BABEL_VERSION_RANGE
|
SUPPORTED_BABEL_VERSION_RANGE,
|
||||||
);
|
);
|
||||||
|
|
||||||
exports.parse = function(code, options) {
|
exports.parse = function(code, options) {
|
||||||
@ -19,7 +19,7 @@ exports.parse = function(code, options) {
|
|||||||
exports.parseForESLint = function(code, options = {}) {
|
exports.parseForESLint = function(code, options = {}) {
|
||||||
if (!IS_RUNNING_SUPPORTED_VERSION) {
|
if (!IS_RUNNING_SUPPORTED_VERSION) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`babel-eslint@${packageJson.version} does not support @babel/core@${CURRENT_BABEL_VERSION}. Please downgrade to babel-eslint@^10 or upgrade to @babel/core@${SUPPORTED_BABEL_VERSION_RANGE}`
|
`babel-eslint@${packageJson.version} does not support @babel/core@${CURRENT_BABEL_VERSION}. Please downgrade to babel-eslint@^10 or upgrade to @babel/core@${SUPPORTED_BABEL_VERSION_RANGE}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@ module.exports = function(code, options) {
|
|||||||
if (config !== null) {
|
if (config !== null) {
|
||||||
if (!config.hasFilesystemConfig()) {
|
if (!config.hasFilesystemConfig()) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`No Babel config file detected for ${config.options.filename}. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.`
|
`No Babel config file detected for ${config.options.filename}. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,9 +7,9 @@ module.exports = Object.assign(
|
|||||||
{
|
{
|
||||||
Literal: ESLINT_VISITOR_KEYS.Literal,
|
Literal: ESLINT_VISITOR_KEYS.Literal,
|
||||||
MethodDefinition: ["decorators"].concat(
|
MethodDefinition: ["decorators"].concat(
|
||||||
ESLINT_VISITOR_KEYS.MethodDefinition
|
ESLINT_VISITOR_KEYS.MethodDefinition,
|
||||||
),
|
),
|
||||||
Property: ["decorators"].concat(ESLINT_VISITOR_KEYS.Property),
|
Property: ["decorators"].concat(ESLINT_VISITOR_KEYS.Property),
|
||||||
},
|
},
|
||||||
BABEL_VISITOR_KEYS
|
BABEL_VISITOR_KEYS,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -32,7 +32,7 @@ module.exports = {
|
|||||||
) {
|
) {
|
||||||
context.report(
|
context.report(
|
||||||
node,
|
node,
|
||||||
"Use path.scope.buildUndefinedNode() to create an undefined identifier directly."
|
"Use path.scope.buildUndefinedNode() to create an undefined identifier directly.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -44,7 +44,7 @@ module.exports = {
|
|||||||
if (!returnValue.properties.some(p => p.key.name === "name")) {
|
if (!returnValue.properties.some(p => p.key.name === "name")) {
|
||||||
context.report(
|
context.report(
|
||||||
returnValue,
|
returnValue,
|
||||||
"This Babel plugin doesn't have a 'name' property."
|
"This Babel plugin doesn't have a 'name' property.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@ const isBabelPluginFactory = require("./is-babel-plugin-factory");
|
|||||||
// is a reference to a @babel/types export.
|
// is a reference to a @babel/types export.
|
||||||
module.exports = function isFromBabelTypes(
|
module.exports = function isFromBabelTypes(
|
||||||
origin /*: ReferenceOrigin */,
|
origin /*: ReferenceOrigin */,
|
||||||
scope /*: Scope */
|
scope /*: Scope */,
|
||||||
) {
|
) {
|
||||||
if (origin.kind === "import" && origin.source === "@babel/types") {
|
if (origin.kind === "import" && origin.source === "@babel/types") {
|
||||||
// imported from @babel/types
|
// imported from @babel/types
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user