Skip to content

Commit

Permalink
Update ESLint/Prettier config for eslint/* packages (babel#10724)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaicataldo authored and nicolo-ribaudo committed Nov 16, 2019
1 parent c37361b commit 401c9bb
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 42 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ packages/babel-standalone/babel.js
packages/babel-standalone/babel.min.js
packages/babel-parser/test/expressions

eslint/*/lib
eslint/*/node_modules
eslint/*/test
eslint/*/tests
7 changes: 6 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ module.exports = {
},
overrides: [
{
files: ["packages/*/src/**/*.js", "codemods/*/src/**/*.js"],
files: [
"packages/*/src/**/*.js",
"codemods/*/src/**/*.js",
"eslint/*/src/**/*.js",
],
rules: {
"@babel/development/no-undefined-identifier": "error",
"@babel/development/no-deprecated-clone": "error",
Expand All @@ -24,6 +28,7 @@ module.exports = {
files: [
"packages/*/test/**/*.js",
"codemods/*/test/**/*.js",
"eslint/*/test/**/*.js",
"packages/babel-helper-transform-fixture-test-runner/src/helpers.js",
"test/**/*.js",
],
Expand Down
6 changes: 4 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
"**/codemods/*/src/**/*.js",
"**/codemods/*/test/**/*.js",
"**/packages/*/src/**/*.js",
"**/packages/*/test/**/*.js"
"**/packages/*/test/**/*.js",
"**/eslint/*/src/**/*.js",
"**/eslint/*/test/**/*.js"
],
"parser": "babylon",
"options": {
"parser": "babel",
"trailingComma": "all"
}
}]
Expand Down
2 changes: 0 additions & 2 deletions eslint/babel-eslint-parser/.eslintignore

This file was deleted.

26 changes: 0 additions & 26 deletions eslint/babel-eslint-parser/.eslintrc.js

This file was deleted.

6 changes: 3 additions & 3 deletions eslint/babel-eslint-parser/src/analyze-scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class Referencer extends OriginalReferencer {
// Flow super types.
this._visitTypeAnnotation(node.implements);
this._visitTypeAnnotation(
node.superTypeParameters && node.superTypeParameters.params
node.superTypeParameters && node.superTypeParameters.params,
);

// Basic.
Expand Down Expand Up @@ -205,7 +205,7 @@ class Referencer extends OriginalReferencer {
_createScopeVariable(node, name) {
this.currentScope().variableScope.__define(
name,
new Definition("Variable", name, node, null, null, null)
new Definition("Variable", name, node, null, null, null),
);
}

Expand All @@ -220,7 +220,7 @@ class Referencer extends OriginalReferencer {
"type-parameters",
parentScope,
node,
false
false,
);

this.scopeManager.__nestScope(scope);
Expand Down
4 changes: 2 additions & 2 deletions eslint/babel-eslint-parser/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const SUPPORTED_BABEL_VERSION_RANGE =
packageJson.peerDependencies["@babel/core"];
const IS_RUNNING_SUPPORTED_VERSION = semver.satisfies(
CURRENT_BABEL_VERSION,
SUPPORTED_BABEL_VERSION_RANGE
SUPPORTED_BABEL_VERSION_RANGE,
);

exports.parse = function(code, options) {
Expand All @@ -19,7 +19,7 @@ exports.parse = function(code, options) {
exports.parseForESLint = function(code, options = {}) {
if (!IS_RUNNING_SUPPORTED_VERSION) {
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}`,
);
}

Expand Down
2 changes: 1 addition & 1 deletion eslint/babel-eslint-parser/src/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module.exports = function(code, options) {
if (config !== null) {
if (!config.hasFilesystemConfig()) {
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.`,
);
}

Expand Down
4 changes: 2 additions & 2 deletions eslint/babel-eslint-parser/src/visitor-keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ module.exports = Object.assign(
{
Literal: ESLINT_VISITOR_KEYS.Literal,
MethodDefinition: ["decorators"].concat(
ESLINT_VISITOR_KEYS.MethodDefinition
ESLINT_VISITOR_KEYS.MethodDefinition,
),
Property: ["decorators"].concat(ESLINT_VISITOR_KEYS.Property),
},
BABEL_VISITOR_KEYS
BABEL_VISITOR_KEYS,
);
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
) {
context.report(
node,
"Use path.scope.buildUndefinedNode() to create an undefined identifier directly."
"Use path.scope.buildUndefinedNode() to create an undefined identifier directly.",
);
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = {
if (!returnValue.properties.some(p => p.key.name === "name")) {
context.report(
returnValue,
"This Babel plugin doesn't have a 'name' property."
"This Babel plugin doesn't have a 'name' property.",
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const isBabelPluginFactory = require("./is-babel-plugin-factory");
// is a reference to a @babel/types export.
module.exports = function isFromBabelTypes(
origin /*: ReferenceOrigin */,
scope /*: Scope */
scope /*: Scope */,
) {
if (origin.kind === "import" && origin.source === "@babel/types") {
// imported from @babel/types
Expand Down

0 comments on commit 401c9bb

Please sign in to comment.