Skip to content

Commit b4d7032

Browse files
targosmarco-ippolito
authored andcommittedMay 3, 2024
tools: use stylistic ESLint plugin for formatting
Refs: https://eslint.org/blog/2023/10/deprecating-formatting-rules/ PR-URL: #50714 Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 29d2011 commit b4d7032

File tree

1,049 files changed

+14778
-4478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,049 files changed

+14778
-4478
lines changed
 

‎.eslintrc.js

+70-67
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const hacks = [
1919
'eslint-plugin-markdown',
2020
'@babel/eslint-parser',
2121
'@babel/plugin-syntax-import-attributes',
22+
'@stylistic/eslint-plugin-js',
2223
];
2324
Module._findPath = (request, paths, isMain) => {
2425
const r = ModuleFindPath(request, paths, isMain);
@@ -39,7 +40,7 @@ module.exports = {
3940
es2022: true,
4041
},
4142
extends: ['eslint:recommended', 'plugin:jsdoc/recommended'],
42-
plugins: ['jsdoc', 'markdown', 'node-core'],
43+
plugins: ['jsdoc', 'markdown', 'node-core', '@stylistic/js'],
4344
parser: '@babel/eslint-parser',
4445
parserOptions: {
4546
babelOptions: {
@@ -133,11 +134,7 @@ module.exports = {
133134
// https://eslint.org/docs/rules/
134135
'accessor-pairs': 'error',
135136
'array-callback-return': 'error',
136-
'arrow-parens': 'error',
137-
'arrow-spacing': 'error',
138137
'block-scoped-var': 'error',
139-
'block-spacing': 'error',
140-
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
141138
'capitalized-comments': ['error', 'always', {
142139
line: {
143140
// Ignore all lines that have less characters than 20 and all lines that
@@ -150,49 +147,17 @@ module.exports = {
150147
ignorePattern: '.*',
151148
},
152149
}],
153-
'comma-dangle': ['error', 'always-multiline'],
154-
'comma-spacing': 'error',
155-
'comma-style': 'error',
156-
'computed-property-spacing': 'error',
157150
'default-case-last': 'error',
158-
'dot-location': ['error', 'property'],
159151
'dot-notation': 'error',
160-
'eol-last': 'error',
161152
'eqeqeq': ['error', 'smart'],
162-
'func-call-spacing': 'error',
163153
'func-name-matching': 'error',
164154
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
165-
'indent': ['error', 2, {
166-
ArrayExpression: 'first',
167-
CallExpression: { arguments: 'first' },
168-
FunctionDeclaration: { parameters: 'first' },
169-
FunctionExpression: { parameters: 'first' },
170-
MemberExpression: 'off',
171-
ObjectExpression: 'first',
172-
SwitchCase: 1,
173-
}],
174-
'key-spacing': 'error',
175-
'keyword-spacing': 'error',
176-
'linebreak-style': 'error',
177-
'max-len': ['error', {
178-
code: 120,
179-
ignorePattern: '^// Flags:',
180-
ignoreRegExpLiterals: true,
181-
ignoreTemplateLiterals: true,
182-
ignoreUrls: true,
183-
tabWidth: 2,
184-
}],
185-
'new-parens': 'error',
186-
'no-confusing-arrow': 'error',
187155
'no-constant-condition': ['error', { checkLoops: false }],
188156
'no-constructor-return': 'error',
189157
'no-duplicate-imports': 'error',
190158
'no-else-return': 'error',
191-
'no-extra-parens': ['error', 'functions'],
192159
'no-lonely-if': 'error',
193160
'no-mixed-requires': 'error',
194-
'no-multi-spaces': ['error', { ignoreEOLComments: true }],
195-
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 0, maxBOF: 0 }],
196161
'no-new-require': 'error',
197162
'no-path-concat': 'error',
198163
'no-proto': 'error',
@@ -257,10 +222,8 @@ module.exports = {
257222
},
258223
],
259224
'no-self-compare': 'error',
260-
'no-tabs': 'error',
261225
'no-template-curly-in-string': 'error',
262226
'no-throw-literal': 'error',
263-
'no-trailing-spaces': 'error',
264227
'no-undef': ['error', { typeof: true }],
265228
'no-undef-init': 'error',
266229
'no-unused-expressions': ['error', { allowShortCircuit: true }],
@@ -276,39 +239,11 @@ module.exports = {
276239
'no-useless-return': 'error',
277240
'no-var': 'error',
278241
'no-void': 'error',
279-
'no-whitespace-before-property': 'error',
280-
'object-curly-newline': 'error',
281-
'object-curly-spacing': ['error', 'always'],
282242
'one-var': ['error', { initialized: 'never' }],
283-
'one-var-declaration-per-line': 'error',
284-
'operator-linebreak': ['error', 'after'],
285-
'padding-line-between-statements': [
286-
'error',
287-
{ blankLine: 'always', prev: 'function', next: 'function' },
288-
],
289243
'prefer-const': ['error', { ignoreReadBeforeAssign: true }],
290244
'prefer-object-has-own': 'error',
291-
'quotes': ['error', 'single', { avoidEscape: true }],
292-
'quote-props': ['error', 'consistent'],
293-
'rest-spread-spacing': 'error',
294-
'semi': 'error',
295-
'semi-spacing': 'error',
296-
'space-before-blocks': ['error', 'always'],
297-
'space-before-function-paren': ['error', {
298-
anonymous: 'never',
299-
named: 'never',
300-
asyncArrow: 'always',
301-
}],
302-
'space-in-parens': 'error',
303-
'space-infix-ops': 'error',
304-
'space-unary-ops': 'error',
305-
'spaced-comment': ['error', 'always', {
306-
'block': { 'balanced': true },
307-
'exceptions': ['-'],
308-
}],
309245
'strict': ['error', 'global'],
310246
'symbol-description': 'error',
311-
'template-curly-spacing': 'error',
312247
'unicode-bom': 'error',
313248
'valid-typeof': ['error', { requireStringLiterals: true }],
314249

@@ -327,6 +262,74 @@ module.exports = {
327262
'jsdoc/check-tag-names': 'off',
328263
'jsdoc/require-returns': 'off',
329264

265+
// Stylistic rules
266+
'@stylistic/js/arrow-parens': 'error',
267+
'@stylistic/js/arrow-spacing': 'error',
268+
'@stylistic/js/block-spacing': 'error',
269+
'@stylistic/js/brace-style': ['error', '1tbs', { allowSingleLine: true }],
270+
'@stylistic/js/comma-dangle': ['error', 'always-multiline'],
271+
'@stylistic/js/comma-spacing': 'error',
272+
'@stylistic/js/comma-style': 'error',
273+
'@stylistic/js/computed-property-spacing': 'error',
274+
'@stylistic/js/dot-location': ['error', 'property'],
275+
'@stylistic/js/eol-last': 'error',
276+
'@stylistic/js/func-call-spacing': 'error',
277+
'@stylistic/js/indent': ['error', 2, {
278+
ArrayExpression: 'first',
279+
CallExpression: { arguments: 'first' },
280+
FunctionDeclaration: { parameters: 'first' },
281+
FunctionExpression: { parameters: 'first' },
282+
MemberExpression: 'off',
283+
ObjectExpression: 'first',
284+
SwitchCase: 1,
285+
}],
286+
'@stylistic/js/key-spacing': 'error',
287+
'@stylistic/js/keyword-spacing': 'error',
288+
'@stylistic/js/linebreak-style': 'error',
289+
'@stylistic/js/max-len': ['error', {
290+
code: 120,
291+
ignorePattern: '^// Flags:',
292+
ignoreRegExpLiterals: true,
293+
ignoreTemplateLiterals: true,
294+
ignoreUrls: true,
295+
tabWidth: 2,
296+
}],
297+
'@stylistic/js/new-parens': 'error',
298+
'@stylistic/js/no-confusing-arrow': 'error',
299+
'@stylistic/js/no-extra-parens': ['error', 'functions'],
300+
'@stylistic/js/no-multi-spaces': ['error', { ignoreEOLComments: true }],
301+
'@stylistic/js/no-multiple-empty-lines': ['error', { max: 2, maxEOF: 0, maxBOF: 0 }],
302+
'@stylistic/js/no-tabs': 'error',
303+
'@stylistic/js/no-trailing-spaces': 'error',
304+
'@stylistic/js/no-whitespace-before-property': 'error',
305+
'@stylistic/js/object-curly-newline': 'error',
306+
'@stylistic/js/object-curly-spacing': ['error', 'always'],
307+
'@stylistic/js/one-var-declaration-per-line': 'error',
308+
'@stylistic/js/operator-linebreak': ['error', 'after'],
309+
'@stylistic/js/padding-line-between-statements': [
310+
'error',
311+
{ blankLine: 'always', prev: 'function', next: 'function' },
312+
],
313+
'@stylistic/js/quotes': ['error', 'single', { avoidEscape: true }],
314+
'@stylistic/js/quote-props': ['error', 'consistent'],
315+
'@stylistic/js/rest-spread-spacing': 'error',
316+
'@stylistic/js/semi': 'error',
317+
'@stylistic/js/semi-spacing': 'error',
318+
'@stylistic/js/space-before-blocks': ['error', 'always'],
319+
'@stylistic/js/space-before-function-paren': ['error', {
320+
anonymous: 'never',
321+
named: 'never',
322+
asyncArrow: 'always',
323+
}],
324+
'@stylistic/js/space-in-parens': 'error',
325+
'@stylistic/js/space-infix-ops': 'error',
326+
'@stylistic/js/space-unary-ops': 'error',
327+
'@stylistic/js/spaced-comment': ['error', 'always', {
328+
'block': { 'balanced': true },
329+
'exceptions': ['-'],
330+
}],
331+
'@stylistic/js/template-curly-spacing': 'error',
332+
330333
// Custom rules from eslint-plugin-node-core
331334
'node-core/no-unescaped-regexp-dot': 'error',
332335
'node-core/no-duplicate-requires': 'error',

‎doc/.eslintrc.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ rules:
1313
prefer-rest-params: error
1414
prefer-template: error
1515

16-
# Stylistic Issues
17-
no-multiple-empty-lines: [error, {max: 1, maxEOF: 0, maxBOF: 0}]
16+
# Stylistic rules
17+
'@stylistic/js/no-multiple-empty-lines': [error, {max: 1, maxEOF: 0, maxBOF: 0}]

0 commit comments

Comments
 (0)
Please sign in to comment.