Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/eslint-config-airbnb-base/legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ module.exports = {
'./rules/errors',
'./rules/node',
'./rules/style',
'./rules/variables'
'./rules/variables',
].map(require.resolve),
env: {
browser: true,
node: true,
amd: false,
mocha: false,
jasmine: false
jasmine: false,
},
rules: {
'comma-dangle': ['error', 'never'],
Expand All @@ -30,5 +30,5 @@ module.exports = {
'no-var': 'off',
'prefer-object-spread': 'off',
strict: ['error', 'safe'],
}
},
};
2 changes: 1 addition & 1 deletion packages/eslint-config-airbnb-base/rules/best-practices.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,6 @@ module.exports = {

// require or disallow Yoda conditions
// https://eslint.org/docs/rules/yoda
yoda: 'error'
yoda: 'error',
}
};
8 changes: 4 additions & 4 deletions packages/eslint-config-airbnb-base/rules/es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ module.exports = {
sourceType: 'module',
ecmaFeatures: {
generators: false,
objectLiteralDuplicateProperties: false
}
objectLiteralDuplicateProperties: false,
},
},

rules: {
Expand Down Expand Up @@ -73,7 +73,7 @@ module.exports = {
// https://eslint.org/docs/rules/no-restricted-imports
'no-restricted-imports': ['off', {
paths: [],
patterns: []
patterns: [],
}],

// disallow to use this/super before super() calling in constructors.
Expand Down Expand Up @@ -180,6 +180,6 @@ module.exports = {

// enforce spacing around the * in yield* expressions
// https://eslint.org/docs/rules/yield-star-spacing
'yield-star-spacing': ['error', 'after']
'yield-star-spacing': ['error', 'after'],
}
};
12 changes: 6 additions & 6 deletions packages/eslint-config-airbnb-base/rules/imports.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
module.exports = {
env: {
es6: true
es6: true,
},
parserOptions: {
ecmaVersion: 6,
sourceType: 'module'
sourceType: 'module',
},
plugins: [
'import'
'import',
],

settings: {
'import/resolver': {
node: {
extensions: ['.mjs', '.js', '.json']
}
extensions: ['.mjs', '.js', '.json'],
},
},
'import/extensions': [
'.js',
Expand Down Expand Up @@ -91,7 +91,7 @@ module.exports = {
'**/protractor.conf.js', // protractor config
'**/protractor.conf.*.js', // protractor config
'**/karma.conf.js', // karma config
'**/.eslintrc.js' // eslint config
'**/.eslintrc.js', // eslint config
],
optionalDependencies: false,
}],
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-airbnb-base/rules/strict.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
rules: {
// babel inserts `'use strict';` for us
strict: ['error', 'never']
}
strict: ['error', 'never'],
},
};
18 changes: 9 additions & 9 deletions packages/eslint-config-airbnb-base/rules/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,22 @@ module.exports = {
// MemberExpression: null,
FunctionDeclaration: {
parameters: 1,
body: 1
body: 1,
},
FunctionExpression: {
parameters: 1,
body: 1
body: 1,
},
CallExpression: {
arguments: 1
arguments: 1,
},
ArrayExpression: 1,
ObjectExpression: 1,
ImportDeclaration: 1,
flatTernaryExpressions: false,
// list derived from https://github.com/benjamn/ast-types/blob/HEAD/def/jsx.js
ignoredNodes: ['JSXElement', 'JSXElement > *', 'JSXAttribute', 'JSXIdentifier', 'JSXNamespacedName', 'JSXMemberExpression', 'JSXSpreadAttribute', 'JSXExpressionContainer', 'JSXOpeningElement', 'JSXClosingElement', 'JSXFragment', 'JSXOpeningFragment', 'JSXClosingFragment', 'JSXText', 'JSXEmptyExpression', 'JSXSpreadChild'],
ignoreComments: false
ignoreComments: false,
}],

// specify whether double or single quotes should be used in JSX attributes
Expand All @@ -160,7 +160,7 @@ module.exports = {
overrides: {
return: { after: true },
throw: { after: true },
case: { after: true }
case: { after: true },
}
}],

Expand Down Expand Up @@ -216,7 +216,7 @@ module.exports = {
'max-lines': ['off', {
max: 300,
skipBlankLines: true,
skipComments: true
skipComments: true,
}],

// enforce a maximum function length
Expand Down Expand Up @@ -307,7 +307,7 @@ module.exports = {
['==', '!=', '===', '!=='],
['&&', '||'],
],
allowSamePrecedence: false
allowSamePrecedence: false,
}],

// disallow mixed spaces and tabs for indentation
Expand Down Expand Up @@ -484,7 +484,7 @@ module.exports = {
'space-before-function-paren': ['error', {
anonymous: 'always',
named: 'never',
asyncArrow: 'always'
asyncArrow: 'always',
}],

// require or disallow spaces inside parentheses
Expand Down Expand Up @@ -529,6 +529,6 @@ module.exports = {
'unicode-bom': ['error', 'never'],

// require regex literals to be wrapped in parentheses
'wrap-regex': 'off'
'wrap-regex': 'off',
}
};
7 changes: 3 additions & 4 deletions packages/eslint-config-airbnb-base/whitespace-async.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const { ESLint } = require('eslint');
const baseConfig = require('.');
const whitespaceRules = require('./whitespaceRules');

const severities = ['off', 'warn', 'error'];

function getSeverity(ruleConfig) {
const severities = ['off', 'warn', 'error'];

if (Array.isArray(ruleConfig)) {
return getSeverity(ruleConfig[0]);
}
Expand All @@ -27,8 +27,7 @@ async function onlyErrorOnRules(rulesToError, config) {
const baseRules = (await cli.calculateConfigForFile(require.resolve('./'))).rules;

entries(baseRules).forEach((rule) => {
const ruleName = rule[0];
const ruleConfig = rule[1];
const [ruleName, ruleConfig] = rule;
const severity = getSeverity(ruleConfig);

if (rulesToError.indexOf(ruleName) === -1 && severity === 'error') {
Expand Down
7 changes: 3 additions & 4 deletions packages/eslint-config-airbnb-base/whitespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ if (CLIEngine) {

const baseConfig = require('.');

const severities = ['off', 'warn', 'error'];

function getSeverity(ruleConfig) {
const severities = ['off', 'warn', 'error'];

if (Array.isArray(ruleConfig)) {
return getSeverity(ruleConfig[0]);
}
Expand All @@ -27,8 +27,7 @@ if (CLIEngine) {
const baseRules = cli.getConfigForFile(require.resolve('./')).rules;

entries(baseRules).forEach((rule) => {
const ruleName = rule[0];
const ruleConfig = rule[1];
const [ruleName, ruleConfig] = rule;
const severity = getSeverity(ruleConfig);

if (rulesToError.indexOf(ruleName) === -1 && severity === 'error') {
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config-airbnb-base/whitespaceRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ module.exports = [
'spaced-comment',
'switch-colon-spacing',
'template-tag-spacing',
'import/newline-after-import'
'import/newline-after-import',
];
2 changes: 1 addition & 1 deletion packages/eslint-config-airbnb/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ module.exports = {
extends: [
'./rules/react-hooks.js',
].map(require.resolve),
rules: {}
rules: {},
};
2 changes: 1 addition & 1 deletion packages/eslint-config-airbnb/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ module.exports = {
'./rules/react',
'./rules/react-a11y',
].map(require.resolve),
rules: {}
rules: {},
};
4 changes: 2 additions & 2 deletions packages/eslint-config-airbnb/rules/react-a11y.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
plugins: [
'jsx-a11y',
'react'
'react',
],

parserOptions: {
Expand Down Expand Up @@ -125,7 +125,7 @@ module.exports = {
labelAttributes: [],
controlComponents: [],
assert: 'both',
depth: 25
depth: 25,
}],

// require HTML element's lang prop to be valid
Expand Down
16 changes: 8 additions & 8 deletions packages/eslint-config-airbnb/rules/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = {
'componentDidUpdate',
'componentWillUnmount',
'componentDidCatch',
'getSnapshotBeforeUpdate'
'getSnapshotBeforeUpdate',
],
}],

Expand Down Expand Up @@ -222,7 +222,7 @@ module.exports = {
'react/prop-types': ['error', {
ignore: [],
customValidators: [],
skipUndeclared: false
skipUndeclared: false,
}],

// Prevent missing React when using JSX
Expand Down Expand Up @@ -280,11 +280,11 @@ module.exports = {
'getSnapshotBeforeUpdate',
'componentDidUpdate',
'componentDidCatch',
'componentWillUnmount'
'componentWillUnmount',
],
rendering: [
'/^render.+$/',
'render'
'render',
],
},
}],
Expand Down Expand Up @@ -343,7 +343,7 @@ module.exports = {

// Forbid certain elements
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-elements.md
'react/forbid-elements': ['off', { forbid: [], }],
'react/forbid-elements': ['off', { forbid: [] }],

// Prevent problem with children and props.dangerouslySetInnerHTML
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
Expand Down Expand Up @@ -585,15 +585,15 @@ module.exports = {
// https://github.com/jsx-eslint/eslint-plugin-react/blob/66b58dd4864678eb869a7bf434c72ff7ac530eb1/docs/rules/sort-default-props.md
// TODO: semver-major, enable?
'react/sort-default-props': ['off', {
ignoreCase: false
ignoreCase: false,
}],
},

settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.json']
}
extensions: ['.js', '.jsx', '.json'],
},
},
react: {
pragma: 'React',
Expand Down
7 changes: 3 additions & 4 deletions packages/eslint-config-airbnb/whitespace-async.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const { ESLint } = require('eslint');
const baseConfig = require('.');
const whitespaceRules = require('./whitespaceRules');

const severities = ['off', 'warn', 'error'];

function getSeverity(ruleConfig) {
const severities = ['off', 'warn', 'error'];

if (Array.isArray(ruleConfig)) {
return getSeverity(ruleConfig[0]);
}
Expand All @@ -27,8 +27,7 @@ async function onlyErrorOnRules(rulesToError, config) {
const baseRules = (await cli.calculateConfigForFile(require.resolve('./'))).rules;

entries(baseRules).forEach((rule) => {
const ruleName = rule[0];
const ruleConfig = rule[1];
const [ruleName, ruleConfig] = rule;
const severity = getSeverity(ruleConfig);

if (rulesToError.indexOf(ruleName) === -1 && severity === 'error') {
Expand Down
7 changes: 3 additions & 4 deletions packages/eslint-config-airbnb/whitespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ if (CLIEngine) {

const baseConfig = require('.');

const severities = ['off', 'warn', 'error'];

function getSeverity(ruleConfig) {
const severities = ['off', 'warn', 'error'];

if (Array.isArray(ruleConfig)) {
return getSeverity(ruleConfig[0]);
}
Expand All @@ -27,8 +27,7 @@ if (CLIEngine) {
const baseRules = cli.getConfigForFile(require.resolve('./')).rules;

entries(baseRules).forEach((rule) => {
const ruleName = rule[0];
const ruleConfig = rule[1];
const [ruleName, ruleConfig] = rule;
const severity = getSeverity(ruleConfig);

if (rulesToError.indexOf(ruleName) === -1 && severity === 'error') {
Expand Down