22
33import unusedImports from "eslint-plugin-unused-imports" ;
44import globals from "globals" ;
5- import path from "node:path" ;
6- import { fileURLToPath } from "node:url" ;
75import js from "@eslint/js" ;
8- import { FlatCompat } from "@eslint/eslintrc" ;
96import tseslint from "typescript-eslint" ;
107import eslintConfigPrettier from "eslint-config-prettier" ;
118import { configs as litConfigs } from "eslint-plugin-lit" ;
@@ -14,35 +11,8 @@ import { configs as a11yConfigs } from "eslint-plugin-lit-a11y";
1411import html from "@html-eslint/eslint-plugin" ;
1512import importX from "eslint-plugin-import-x" ;
1613
17- const _filename = fileURLToPath ( import . meta. url ) ;
18- const _dirname = path . dirname ( _filename ) ;
19- const compat = new FlatCompat ( {
20- baseDirectory : _dirname ,
21- recommendedConfig : js . configs . recommended ,
22- allConfig : js . configs . all ,
23- } ) ;
24-
25- // Load airbnb-base via FlatCompat for non-import rules only.
26- // eslint-plugin-import is incompatible with ESLint 10 (uses removed APIs),
27- // so we strip its plugin/rules/settings and use eslint-plugin-import-x instead.
28- const airbnbConfigs = compat . extends ( "airbnb-base" ) . map ( ( config ) => {
29- const { plugins = { } , rules = { } , settings = { } , ...rest } = config ;
30- return {
31- ...rest ,
32- plugins : Object . fromEntries (
33- Object . entries ( plugins ) . filter ( ( [ key ] ) => key !== "import" )
34- ) ,
35- rules : Object . fromEntries (
36- Object . entries ( rules ) . filter ( ( [ key ] ) => ! key . startsWith ( "import/" ) )
37- ) ,
38- settings : Object . fromEntries (
39- Object . entries ( settings ) . filter ( ( [ key ] ) => ! key . startsWith ( "import/" ) )
40- ) ,
41- } ;
42- } ) ;
43-
4414export default tseslint . config (
45- ... airbnbConfigs ,
15+ js . configs . recommended ,
4616 eslintConfigPrettier ,
4717 litConfigs [ "flat/all" ] ,
4818 tseslint . configs . recommended ,
@@ -86,35 +56,61 @@ export default tseslint.config(
8656 } ,
8757
8858 rules : {
89- "class-methods-use-this" : "off" ,
90- "new-cap" : "off" ,
91- "prefer-template" : "off" ,
92- "object-shorthand" : "off" ,
93- "func-names" : "off" ,
94- "no-underscore-dangle" : "off" ,
95- strict : "off" ,
96- "no-plusplus" : "off" ,
59+ // Cherry-picked safety rules (previously provided by airbnb-base)
60+ "array-callback-return" : [ "error" , { allowImplicit : true } ] ,
61+ "block-scoped-var" : "error" ,
62+ "consistent-return" : "error" ,
63+ curly : [ "error" , "multi-line" ] ,
64+ "default-case-last" : "error" ,
65+ eqeqeq : [ "error" , "always" , { null : "ignore" } ] ,
66+ "guard-for-in" : "error" ,
67+ "no-await-in-loop" : "error" ,
68+ "no-caller" : "error" ,
69+ "no-constructor-return" : "error" ,
70+ "no-eval" : "error" ,
71+ "no-extend-native" : "error" ,
72+ "no-implied-eval" : "error" ,
73+ "no-iterator" : "error" ,
74+ "no-new-func" : "error" ,
75+ "no-new-wrappers" : "error" ,
76+ "no-octal-escape" : "error" ,
77+ "no-promise-executor-return" : "error" ,
78+ "no-return-assign" : [ "error" , "always" ] ,
79+ "no-script-url" : "error" ,
80+ "no-self-compare" : "error" ,
81+ "no-sequences" : "error" ,
82+ "no-template-curly-in-string" : "error" ,
83+ "no-unreachable-loop" : "error" ,
84+
85+ // Cherry-picked style rules (previously provided by airbnb-base)
86+ "no-else-return" : [ "error" , { allowElseIf : false } ] ,
87+ "no-lonely-if" : "error" ,
88+ "no-unneeded-ternary" : [ "error" , { defaultAssignment : false } ] ,
89+ "no-useless-computed-key" : "error" ,
90+ "no-useless-concat" : "error" ,
91+ "no-useless-rename" : "error" ,
92+ "no-useless-return" : "error" ,
93+ "one-var" : [ "error" , "never" ] ,
94+ "operator-assignment" : [ "error" , "always" ] ,
95+ "prefer-arrow-callback" : "error" ,
96+ "prefer-exponentiation-operator" : "error" ,
97+ "prefer-object-spread" : "error" ,
98+ "prefer-regex-literals" : [ "error" , { disallowRedundantWrapping : true } ] ,
99+ "symbol-description" : "error" ,
100+ yoda : "error" ,
101+
102+ // TODO: Enable once violations are fixed (43 instances as of 2026-04)
103+ // "no-useless-assignment": "error",
104+ "no-useless-assignment" : "off" ,
105+
106+ // Project rules
97107 "no-bitwise" : "error" ,
98- "comma-dangle" : "off" ,
99- "vars-on-top" : "off" ,
100- "no-continue" : "off" ,
101- "no-param-reassign" : "off" ,
102- "no-multi-assign" : "off" ,
103108 "no-console" : "error" ,
104- radix : "off" ,
105- "no-alert" : "off" ,
106- "no-nested-ternary" : "off" ,
107- "prefer-destructuring" : "off" ,
108109 "no-restricted-globals" : [ 2 , "event" ] ,
109- "prefer-promise-reject-errors" : "off" ,
110110 "no-restricted-syntax" : [ "error" , "LabeledStatement" , "WithStatement" ] ,
111- "object-curly-newline" : "off" ,
112- "default-case" : "off" ,
113111 "wc/no-self-class" : "off" ,
114- "no-shadow" : "off" ,
115- "no-use-before-define" : "off" ,
116112
117- // import-x rules (migrated from eslint-plugin-import / airbnb-base)
113+ // import-x rules
118114 "import-x/named" : "off" ,
119115 "import-x/prefer-default-export" : "off" ,
120116 "import-x/no-default-export" : "off" ,
@@ -146,13 +142,9 @@ export default tseslint.config(
146142 "import-x/no-relative-packages" : "error" ,
147143
148144 // TypeScript rules
149- "@typescript-eslint/camelcase" : "off" ,
150145 "@typescript-eslint/ban-ts-comment" : "off" ,
151- "@typescript-eslint/no-use-before-define" : "off" ,
152146 "@typescript-eslint/no-non-null-assertion" : "off" ,
153147 "@typescript-eslint/no-explicit-any" : "off" ,
154- "@typescript-eslint/explicit-function-return-type" : "off" ,
155- "@typescript-eslint/explicit-module-boundary-types" : "off" ,
156148 "@typescript-eslint/no-shadow" : [ "error" ] ,
157149
158150 "@typescript-eslint/naming-convention" : [
@@ -216,7 +208,6 @@ export default tseslint.config(
216208 "lit-a11y/role-has-required-aria-attrs" : "error" ,
217209 "@typescript-eslint/consistent-type-imports" : "error" ,
218210 "@typescript-eslint/no-import-type-side-effects" : "error" ,
219- camelcase : "off" ,
220211 "@typescript-eslint/no-dynamic-delete" : "off" ,
221212 "@typescript-eslint/no-empty-object-type" : [
222213 "error" ,
0 commit comments