@@ -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,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" ] ,
0 commit comments