@@ -8,11 +8,13 @@ import js from '@eslint/js'
88import jsoncEslintParser from 'jsonc-eslint-parser'
99import eslintPluginJsonc from 'eslint-plugin-jsonc'
1010import 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'
1511import 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+
1618import freetube from './_scripts/eslint-rules/plugin.mjs'
1719
1820import activeLocales from './static/locales/activeLocales.json' with { type : 'json' }
@@ -27,10 +29,254 @@ 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+ 'constructor-super' : 'error' ,
68+ curly : [ 'error' , 'multi-line' ] ,
69+ 'default-case-last' : 'error' ,
70+ eqeqeq : [ 'error' , 'always' , { null : 'ignore' } ] ,
71+ 'new-cap' : [ 'error' , { newIsCap : true , capIsNew : false , properties : true } ] ,
72+ 'no-array-constructor' : 'error' ,
73+ 'no-async-promise-executor' : 'error' ,
74+ 'no-caller' : 'error' ,
75+ 'no-case-declarations' : 'error' ,
76+ 'no-class-assign' : 'error' ,
77+ 'no-compare-neg-zero' : 'error' ,
78+ 'no-cond-assign' : 'error' ,
79+ 'no-const-assign' : 'error' ,
80+ 'no-constant-condition' : [ 'error' , { checkLoops : false } ] ,
81+ 'no-control-regex' : 'error' ,
82+ 'no-debugger' : 'error' ,
83+ 'no-delete-var' : 'error' ,
84+ 'no-dupe-args' : 'error' ,
85+ 'no-dupe-class-members' : 'error' ,
86+ 'no-dupe-keys' : 'error' ,
87+ 'no-duplicate-case' : 'error' ,
88+ 'no-useless-backreference' : 'error' ,
89+ 'no-empty' : [ 'error' , { allowEmptyCatch : true } ] ,
90+ 'no-empty-character-class' : 'error' ,
91+ 'no-empty-pattern' : 'error' ,
92+ 'no-eval' : 'error' ,
93+ 'no-ex-assign' : 'error' ,
94+ 'no-extend-native' : 'error' ,
95+ 'no-extra-bind' : 'error' ,
96+ 'no-extra-boolean-cast' : 'error' ,
97+ 'no-fallthrough' : 'error' ,
98+ 'no-func-assign' : 'error' ,
99+ 'no-global-assign' : 'error' ,
100+ 'no-implied-eval' : 'error' ,
101+ 'no-import-assign' : 'error' ,
102+ 'no-invalid-regexp' : 'error' ,
103+ 'no-irregular-whitespace' : 'error' ,
104+ 'no-iterator' : 'error' ,
105+ 'no-labels' : [ 'error' , { allowLoop : false , allowSwitch : false } ] ,
106+ 'no-lone-blocks' : 'error' ,
107+ 'no-loss-of-precision' : 'error' ,
108+ 'no-misleading-character-class' : 'error' ,
109+ 'no-prototype-builtins' : 'error' ,
110+ 'no-useless-catch' : 'error' ,
111+ 'no-multi-str' : 'error' ,
112+ 'no-new' : 'error' ,
113+ 'no-new-func' : 'error' ,
114+ 'no-object-constructor' : 'error' ,
115+ 'no-new-native-nonconstructor' : 'error' ,
116+ 'no-new-wrappers' : 'error' ,
117+ 'no-obj-calls' : 'error' ,
118+ 'no-octal' : 'error' ,
119+ 'no-octal-escape' : 'error' ,
120+ 'no-proto' : 'error' ,
121+ 'no-redeclare' : [ 'error' , { builtinGlobals : false } ] ,
122+ 'no-regex-spaces' : 'error' ,
123+ 'no-return-assign' : [ 'error' , 'except-parens' ] ,
124+ 'no-self-assign' : [ 'error' , { props : true } ] ,
125+ 'no-self-compare' : 'error' ,
126+ 'no-sequences' : 'error' ,
127+ 'no-shadow-restricted-names' : 'error' ,
128+ 'no-sparse-arrays' : 'error' ,
129+ 'no-template-curly-in-string' : 'error' ,
130+ 'no-this-before-super' : 'error' ,
131+ 'no-throw-literal' : 'error' ,
132+ 'no-undef' : 'error' ,
133+ 'no-undef-init' : 'error' ,
134+ 'no-unexpected-multiline' : 'error' ,
135+ 'no-unmodified-loop-condition' : 'error' ,
136+ 'no-unneeded-ternary' : [ 'error' , { defaultAssignment : false } ] ,
137+ 'no-unreachable' : 'error' ,
138+ 'no-unreachable-loop' : 'error' ,
139+ 'no-unsafe-finally' : 'error' ,
140+ 'no-unsafe-negation' : 'error' ,
141+ 'no-unused-expressions' : [ 'error' , {
142+ allowShortCircuit : true ,
143+ allowTernary : true ,
144+ allowTaggedTemplates : true ,
145+ } ] ,
146+ 'no-unused-vars' : [ 'error' , {
147+ args : 'none' ,
148+ caughtErrors : 'none' ,
149+ ignoreRestSiblings : true ,
150+ vars : 'all' ,
151+ } ] ,
152+ 'no-use-before-define' : [ 'error' , { functions : false , classes : false , variables : false } ] ,
153+ 'no-useless-call' : 'error' ,
154+ 'no-useless-computed-key' : 'error' ,
155+ 'no-useless-constructor' : 'error' ,
156+ 'no-useless-escape' : 'error' ,
157+ 'no-useless-rename' : 'error' ,
158+ 'no-useless-return' : 'error' ,
159+ 'no-void' : 'error' ,
160+ 'no-with' : 'error' ,
161+ 'one-var' : [ 'error' , { initialized : 'never' } ] ,
162+ 'prefer-const' : [ 'error' , { destructuring : 'all' } ] ,
163+ 'prefer-promise-reject-errors' : 'error' ,
164+ 'prefer-regex-literals' : [ 'error' , { disallowRedundantWrapping : true } ] ,
165+ 'symbol-description' : 'error' ,
166+ 'unicode-bom' : [ 'error' , 'never' ] ,
167+ 'use-isnan' : [ 'error' , {
168+ enforceForSwitchCase : true ,
169+ enforceForIndexOf : true ,
170+ } ] ,
171+ 'valid-typeof' : [ 'error' , { requireStringLiterals : true } ] ,
172+ yoda : [ 'error' , 'never' ] ,
173+
174+ 'import-x/export' : 'error' ,
175+ 'import-x/first' : 'error' ,
176+ 'import-x/no-absolute-path' : [ 'error' , { esmodule : true , commonjs : true , amd : false } ] ,
177+ 'import-x/no-duplicates' : 'error' ,
178+ 'import-x/no-named-default' : 'error' ,
179+ 'import-x/no-webpack-loader-syntax' : 'error' ,
180+
181+ 'n/handle-callback-err' : [ 'error' , '^(err|error)$' ] ,
182+ 'n/no-callback-literal' : 'error' ,
183+ 'n/no-deprecated-api' : 'warn' ,
184+ 'n/no-exports-assign' : 'error' ,
185+ 'n/no-new-require' : 'error' ,
186+ 'n/no-path-concat' : 'error' ,
187+ 'n/process-exit-as-throw' : 'error' ,
188+
189+ 'promise/param-names' : 'error' ,
190+ } ,
191+ } ,
192+ {
193+ name : 'style' ,
194+
195+ plugins : {
196+ '@stylistic' : stylistic ,
197+ } ,
198+ rules : {
199+ '@stylistic/array-bracket-spacing' : [ 'error' , 'never' ] ,
200+ '@stylistic/arrow-spacing' : [ 'error' , { before : true , after : true } ] ,
201+ '@stylistic/block-spacing' : [ 'error' , 'always' ] ,
202+ '@stylistic/brace-style' : [ 'error' , '1tbs' , { allowSingleLine : true } ] ,
203+ '@stylistic/comma-dangle' : [ 'warn' , {
204+ arrays : 'ignore' ,
205+ enums : 'ignore' ,
206+ exports : 'ignore' ,
207+ imports : 'ignore' ,
208+ objects : 'ignore' ,
209+ } ] ,
210+ '@stylistic/comma-spacing' : [ 'error' , { before : false , after : true } ] ,
211+ '@stylistic/comma-style' : [ 'error' , 'last' ] ,
212+ '@stylistic/computed-property-spacing' : [ 'error' , 'never' , { enforceForClassMembers : true } ] ,
213+ '@stylistic/dot-location' : [ 'error' , 'property' ] ,
214+ '@stylistic/eol-last' : 'error' ,
215+ '@stylistic/function-call-spacing' : [ 'error' , 'never' ] ,
216+ '@stylistic/generator-star-spacing' : [ 'error' , { before : true , after : true } ] ,
217+ '@stylistic/indent' : [ 'error' , 2 , {
218+ SwitchCase : 1 ,
219+ VariableDeclarator : 1 ,
220+ outerIIFEBody : 1 ,
221+ MemberExpression : 1 ,
222+ FunctionDeclaration : { parameters : 1 , body : 1 } ,
223+ FunctionExpression : { parameters : 1 , body : 1 } ,
224+ CallExpression : { arguments : 1 } ,
225+ ArrayExpression : 1 ,
226+ ObjectExpression : 1 ,
227+ ImportDeclaration : 1 ,
228+ flatTernaryExpressions : false ,
229+ ignoreComments : false ,
230+ ignoredNodes : [ 'TemplateLiteral *' ] ,
231+ offsetTernaryExpressions : true ,
232+ } ] ,
233+ '@stylistic/key-spacing' : [ 'error' , { beforeColon : false , afterColon : true } ] ,
234+ '@stylistic/keyword-spacing' : [ 'error' , { before : true , after : true } ] ,
235+ '@stylistic/lines-between-class-members' : [ 'error' , 'always' , { exceptAfterSingleLine : true } ] ,
236+ '@stylistic/multiline-ternary' : [ 'error' , 'always-multiline' ] ,
237+ '@stylistic/new-parens' : 'error' ,
238+ '@stylistic/no-extra-parens' : [ 'error' , 'functions' ] ,
239+ '@stylistic/no-floating-decimal' : 'error' ,
240+ '@stylistic/no-mixed-operators' : [ 'error' , {
241+ groups : [
242+ [ '==' , '!=' , '===' , '!==' , '>' , '>=' , '<' , '<=' ] ,
243+ [ '&&' , '||' ] ,
244+ [ 'in' , 'instanceof' ] ,
245+ ] ,
246+ allowSamePrecedence : true ,
247+ } ] ,
248+ '@stylistic/no-mixed-spaces-and-tabs' : 'error' ,
249+ '@stylistic/no-multi-spaces' : [ 'error' , { ignoreEOLComments : true } ] ,
250+ '@stylistic/no-multiple-empty-lines' : [ 'error' , { max : 1 , maxBOF : 0 , maxEOF : 0 } ] ,
251+ '@stylistic/no-tabs' : 'error' ,
252+ '@stylistic/no-trailing-spaces' : 'error' ,
253+ '@stylistic/no-whitespace-before-property' : 'error' ,
254+ '@stylistic/object-curly-newline' : [ 'error' , { multiline : true , consistent : true } ] ,
255+ '@stylistic/object-curly-spacing' : [ 'error' , 'always' ] ,
256+ '@stylistic/object-property-newline' : [ 'error' , { allowAllPropertiesOnSameLine : true } ] ,
257+ '@stylistic/operator-linebreak' : [ 'error' , 'after' , { overrides : { '?' : 'before' , ':' : 'before' , '|>' : 'before' } } ] ,
258+ '@stylistic/padded-blocks' : [ 'error' , { blocks : 'never' , switches : 'never' , classes : 'never' } ] ,
259+ '@stylistic/quote-props' : [ 'error' , 'as-needed' ] ,
260+ '@stylistic/quotes' : [ 'error' , 'single' , { avoidEscape : true , allowTemplateLiterals : 'never' } ] ,
261+ '@stylistic/rest-spread-spacing' : [ 'error' , 'never' ] ,
262+ '@stylistic/semi' : [ 'error' , 'never' ] ,
263+ '@stylistic/semi-spacing' : [ 'error' , { before : false , after : true } ] ,
264+ '@stylistic/space-before-blocks' : [ 'error' , 'always' ] ,
265+ '@stylistic/space-before-function-paren' : [ 'error' , 'always' ] ,
266+ '@stylistic/space-in-parens' : [ 'error' , 'never' ] ,
267+ '@stylistic/space-infix-ops' : 'error' ,
268+ '@stylistic/space-unary-ops' : [ 'error' , { words : true , nonwords : false } ] ,
269+ '@stylistic/spaced-comment' : [ 'error' , 'always' , {
270+ line : { markers : [ '*package' , '!' , '/' , ',' , '=' ] } ,
271+ block : { balanced : true , markers : [ '*package' , '!' , ',' , ':' , '::' , 'flow-include' ] , exceptions : [ '*' ] } ,
272+ } ] ,
273+ '@stylistic/template-curly-spacing' : [ 'error' , 'never' ] ,
274+ '@stylistic/template-tag-spacing' : [ 'error' , 'never' ] ,
275+ '@stylistic/wrap-iife' : [ 'error' , 'any' , { functionPrototypeMethods : true } ] ,
276+ '@stylistic/yield-star-spacing' : [ 'error' , 'both' ] ,
277+ } ,
278+ } ,
279+
34280 js . configs . recommended ,
35281 ...eslintPluginVue . configs [ 'flat/recommended' ] ,
36282 ...vuejsAccessibility . configs [ "flat/recommended" ] ,
0 commit comments