Skip to content

Commit 0d3d59b

Browse files
authored
Drop neostandard in favour of only pulling in the dev dependencies that we actually use (#8724)
* Drop neostandard in favour of only pulling in the dev dependencies that we actually use * Remove rules that are already listed in the @eslint/js recommended config
1 parent cfc8bb3 commit 0d3d59b

File tree

7 files changed

+410
-1125
lines changed

7 files changed

+410
-1125
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ updates:
2121
- "vue-eslint-parser"
2222
- "neostandard"
2323
- "@intlify/eslint-plugin-vue-i18n"
24+
- "@stylistic/eslint-plugin"
2425
stylelint:
2526
patterns:
2627
- "stylelint"

eslint.config.mjs

Lines changed: 210 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ import js from '@eslint/js'
88
import jsoncEslintParser from 'jsonc-eslint-parser'
99
import eslintPluginJsonc from 'eslint-plugin-jsonc'
1010
import eslintPluginYml from 'eslint-plugin-yml'
11-
// Faster than importing the default import,
12-
// because the default import imports a lot of other dependencies
13-
// for the `resolveIgnoresFromGitignore` function that we don't use
14-
import { neostandard } from 'neostandard/lib/main.js'
1511
import jsdoc from 'eslint-plugin-jsdoc'
12+
13+
import stylistic from '@stylistic/eslint-plugin'
14+
import eslintPluginImportX from 'eslint-plugin-import-x'
15+
import eslintPluginN from 'eslint-plugin-n'
16+
import eslintPluginPromise from 'eslint-plugin-promise'
17+
1618
import freetube from './_scripts/eslint-rules/plugin.mjs'
1719

1820
import activeLocales from './static/locales/activeLocales.json' with { type: 'json' }
@@ -27,10 +29,210 @@ export default [
2729
'static/geolocations/'
2830
]
2931
},
30-
...neostandard({
31-
noJsx: true,
32-
ts: false,
33-
}),
32+
{
33+
name: 'base',
34+
35+
languageOptions: {
36+
ecmaVersion: 2022,
37+
sourceType: 'module',
38+
globals: {
39+
...globals.es2022,
40+
...globals.node,
41+
document: 'readonly',
42+
navigator: 'readonly',
43+
window: 'readonly',
44+
},
45+
},
46+
47+
plugins: {
48+
'import-x': eslintPluginImportX,
49+
n: eslintPluginN,
50+
promise: eslintPluginPromise,
51+
},
52+
53+
rules: {
54+
'no-var': 'warn',
55+
'object-shorthand': ['warn', 'properties'],
56+
57+
'accessor-pairs': ['error', { setWithoutGet: true, enforceForClassMembers: true }],
58+
'array-callback-return': ['error', {
59+
allowImplicit: false,
60+
checkForEach: false,
61+
}],
62+
camelcase: ['error', {
63+
allow: ['^UNSAFE_'],
64+
properties: 'never',
65+
ignoreGlobals: true,
66+
}],
67+
curly: ['error', 'multi-line'],
68+
'default-case-last': 'error',
69+
eqeqeq: ['error', 'always', { null: 'ignore' }],
70+
'new-cap': ['error', { newIsCap: true, capIsNew: false, properties: true }],
71+
'no-array-constructor': 'error',
72+
'no-caller': 'error',
73+
'no-constant-condition': ['error', { checkLoops: false }],
74+
'no-empty': ['error', { allowEmptyCatch: true }],
75+
'no-eval': 'error',
76+
'no-extend-native': 'error',
77+
'no-extra-bind': 'error',
78+
'no-implied-eval': 'error',
79+
'no-iterator': 'error',
80+
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
81+
'no-lone-blocks': 'error',
82+
'no-multi-str': 'error',
83+
'no-new': 'error',
84+
'no-new-func': 'error',
85+
'no-object-constructor': 'error',
86+
'no-new-wrappers': 'error',
87+
'no-octal-escape': 'error',
88+
'no-proto': 'error',
89+
'no-redeclare': ['error', { builtinGlobals: false }],
90+
'no-return-assign': ['error', 'except-parens'],
91+
'no-self-compare': 'error',
92+
'no-sequences': 'error',
93+
'no-template-curly-in-string': 'error',
94+
'no-throw-literal': 'error',
95+
'no-undef-init': 'error',
96+
'no-unmodified-loop-condition': 'error',
97+
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
98+
'no-unreachable-loop': 'error',
99+
'no-unused-expressions': ['error', {
100+
allowShortCircuit: true,
101+
allowTernary: true,
102+
allowTaggedTemplates: true,
103+
}],
104+
'no-unused-vars': ['error', {
105+
args: 'none',
106+
caughtErrors: 'none',
107+
ignoreRestSiblings: true,
108+
vars: 'all',
109+
}],
110+
'no-use-before-define': ['error', { functions: false, classes: false, variables: false }],
111+
'no-useless-call': 'error',
112+
'no-useless-computed-key': 'error',
113+
'no-useless-constructor': 'error',
114+
'no-useless-rename': 'error',
115+
'no-useless-return': 'error',
116+
'no-void': 'error',
117+
'one-var': ['error', { initialized: 'never' }],
118+
'prefer-const': ['error', { destructuring: 'all' }],
119+
'prefer-promise-reject-errors': 'error',
120+
'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
121+
'symbol-description': 'error',
122+
'unicode-bom': ['error', 'never'],
123+
'use-isnan': ['error', {
124+
enforceForSwitchCase: true,
125+
enforceForIndexOf: true,
126+
}],
127+
'valid-typeof': ['error', { requireStringLiterals: true }],
128+
yoda: ['error', 'never'],
129+
130+
'import-x/export': 'error',
131+
'import-x/first': 'error',
132+
'import-x/no-absolute-path': ['error', { esmodule: true, commonjs: true, amd: false }],
133+
'import-x/no-duplicates': 'error',
134+
'import-x/no-named-default': 'error',
135+
'import-x/no-webpack-loader-syntax': 'error',
136+
137+
'n/handle-callback-err': ['error', '^(err|error)$'],
138+
'n/no-callback-literal': 'error',
139+
'n/no-deprecated-api': 'warn',
140+
'n/no-exports-assign': 'error',
141+
'n/no-new-require': 'error',
142+
'n/no-path-concat': 'error',
143+
'n/process-exit-as-throw': 'error',
144+
145+
'promise/param-names': 'error',
146+
},
147+
},
148+
{
149+
name: 'style',
150+
151+
plugins: {
152+
'@stylistic': stylistic,
153+
},
154+
rules: {
155+
'@stylistic/array-bracket-spacing': ['error', 'never'],
156+
'@stylistic/arrow-spacing': ['error', { before: true, after: true }],
157+
'@stylistic/block-spacing': ['error', 'always'],
158+
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
159+
'@stylistic/comma-dangle': ['warn', {
160+
arrays: 'ignore',
161+
enums: 'ignore',
162+
exports: 'ignore',
163+
imports: 'ignore',
164+
objects: 'ignore',
165+
}],
166+
'@stylistic/comma-spacing': ['error', { before: false, after: true }],
167+
'@stylistic/comma-style': ['error', 'last'],
168+
'@stylistic/computed-property-spacing': ['error', 'never', { enforceForClassMembers: true }],
169+
'@stylistic/dot-location': ['error', 'property'],
170+
'@stylistic/eol-last': 'error',
171+
'@stylistic/function-call-spacing': ['error', 'never'],
172+
'@stylistic/generator-star-spacing': ['error', { before: true, after: true }],
173+
'@stylistic/indent': ['error', 2, {
174+
SwitchCase: 1,
175+
VariableDeclarator: 1,
176+
outerIIFEBody: 1,
177+
MemberExpression: 1,
178+
FunctionDeclaration: { parameters: 1, body: 1 },
179+
FunctionExpression: { parameters: 1, body: 1 },
180+
CallExpression: { arguments: 1 },
181+
ArrayExpression: 1,
182+
ObjectExpression: 1,
183+
ImportDeclaration: 1,
184+
flatTernaryExpressions: false,
185+
ignoreComments: false,
186+
ignoredNodes: ['TemplateLiteral *'],
187+
offsetTernaryExpressions: true,
188+
}],
189+
'@stylistic/key-spacing': ['error', { beforeColon: false, afterColon: true }],
190+
'@stylistic/keyword-spacing': ['error', { before: true, after: true }],
191+
'@stylistic/lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
192+
'@stylistic/multiline-ternary': ['error', 'always-multiline'],
193+
'@stylistic/new-parens': 'error',
194+
'@stylistic/no-extra-parens': ['error', 'functions'],
195+
'@stylistic/no-floating-decimal': 'error',
196+
'@stylistic/no-mixed-operators': ['error', {
197+
groups: [
198+
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
199+
['&&', '||'],
200+
['in', 'instanceof'],
201+
],
202+
allowSamePrecedence: true,
203+
}],
204+
'@stylistic/no-mixed-spaces-and-tabs': 'error',
205+
'@stylistic/no-multi-spaces': ['error', { ignoreEOLComments: true }],
206+
'@stylistic/no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
207+
'@stylistic/no-tabs': 'error',
208+
'@stylistic/no-trailing-spaces': 'error',
209+
'@stylistic/no-whitespace-before-property': 'error',
210+
'@stylistic/object-curly-newline': ['error', { multiline: true, consistent: true }],
211+
'@stylistic/object-curly-spacing': ['error', 'always'],
212+
'@stylistic/object-property-newline': ['error', { allowAllPropertiesOnSameLine: true }],
213+
'@stylistic/operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before', '|>': 'before' } }],
214+
'@stylistic/padded-blocks': ['error', { blocks: 'never', switches: 'never', classes: 'never' }],
215+
'@stylistic/quote-props': ['error', 'as-needed'],
216+
'@stylistic/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: 'never' }],
217+
'@stylistic/rest-spread-spacing': ['error', 'never'],
218+
'@stylistic/semi': ['error', 'never'],
219+
'@stylistic/semi-spacing': ['error', { before: false, after: true }],
220+
'@stylistic/space-before-blocks': ['error', 'always'],
221+
'@stylistic/space-before-function-paren': ['error', 'always'],
222+
'@stylistic/space-in-parens': ['error', 'never'],
223+
'@stylistic/space-infix-ops': 'error',
224+
'@stylistic/space-unary-ops': ['error', { words: true, nonwords: false }],
225+
'@stylistic/spaced-comment': ['error', 'always', {
226+
line: { markers: ['*package', '!', '/', ',', '='] },
227+
block: { balanced: true, markers: ['*package', '!', ',', ':', '::', 'flow-include'], exceptions: ['*'] },
228+
}],
229+
'@stylistic/template-curly-spacing': ['error', 'never'],
230+
'@stylistic/template-tag-spacing': ['error', 'never'],
231+
'@stylistic/wrap-iife': ['error', 'any', { functionPrototypeMethods: true }],
232+
'@stylistic/yield-star-spacing': ['error', 'both'],
233+
},
234+
},
235+
34236
js.configs.recommended,
35237
...eslintPluginVue.configs['flat/recommended'],
36238
...vuejsAccessibility.configs["flat/recommended"],

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,19 @@
7777
"@double-great/stylelint-a11y": "^3.4.3",
7878
"@eslint/js": "^9.39.2",
7979
"@intlify/eslint-plugin-vue-i18n": "^4.1.1",
80+
"@stylistic/eslint-plugin": "^5.9.0",
8081
"babel-loader": "^10.0.0",
8182
"copy-webpack-plugin": "^13.0.1",
8283
"css-loader": "^7.1.4",
8384
"css-minimizer-webpack-plugin": "^7.0.4",
8485
"electron": "^40.6.1",
8586
"electron-builder": "^26.8.1",
8687
"eslint": "^9.39.2",
88+
"eslint-plugin-import-x": "^4.16.1",
8789
"eslint-plugin-jsdoc": "^62.5.2",
8890
"eslint-plugin-jsonc": "^2.21.0",
91+
"eslint-plugin-n": "^17.24.0",
92+
"eslint-plugin-promise": "^7.2.1",
8993
"eslint-plugin-unicorn": "^62.0.0",
9094
"eslint-plugin-vue": "^10.7.0",
9195
"eslint-plugin-vuejs-accessibility": "^2.4.1",
@@ -96,7 +100,6 @@
96100
"json-minimizer-webpack-plugin": "^5.0.1",
97101
"lefthook": "^2.1.1",
98102
"mini-css-extract-plugin": "^2.10.0",
99-
"neostandard": "^0.12.2",
100103
"npm-run-all2": "^8.0.4",
101104
"postcss": "^8.5.6",
102105
"postcss-scss": "^4.0.9",

static/locales/ar.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,5 +1090,5 @@ Description:
10901090
Expand Description: '...المزيد'
10911091
Autoplay Interruption Timer: تم إلغاء التشغيل التلقائي بسبب {autoplayInterruptionIntervalHours} ساعات من عدم النشاط
10921092
shortcutJoinOperator: +
1093-
shortcutLabelSeparator: '|'
1093+
shortcutLabelSeparator: '{''|''}'
10941094
KeyboardShortcutTemplate: '{label} ({shortcut})'

static/locales/bg.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,6 @@ KeyboardShortcutPrompt:
11081108
End: Преминаване към края на видеото
11091109
Skip to Next Video: Преминаване към следващото видео в плейлиста или към следващото препоръчано
11101110
Skip to Previous Video: Преминаване към предходното видео в плейлиста
1111-
shortcutLabelSeparator: '|'
1111+
shortcutLabelSeparator: '{''|''}'
11121112
Compact side navigation: Компактна странична навигация
11131113
Expand side navigation: Разширена странична навигация

static/locales/eu.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ User Playlists:
124124
This playlist currently has no videos.: Erreprodukzio-zerrenda honek ez du bideorik.
125125
Create New Playlist: Sortu erreprodukzio-zerrenda berria
126126
Add to Playlist: Gehitu erreprodukzio-zerrendara
127-
Add to Favorites: Gehitu {playlistName zerrendara
127+
Add to Favorites: Gehitu {playlistName} zerrendara
128128
Remove from Favorites: Kendu {playlistName} zerrendatik
129129
Move Video Up: Mugitu bideoa gora
130130
Move Video Down: Mugitu bideoa behera

0 commit comments

Comments
 (0)