Skip to content

Commit 218b36b

Browse files
AlistairNormanadammathysjarednormanforkatasenemsoy
committed
Update to eslint flat config
This is the new config format as of eslint 10. Co-Authored-By: Adam Mueller <adam@super.gd> Co-Authored-By: Jared Norman <jared@super.gd> Co-Authored-By: Chris Todorov <chris@super.gd> Co-Authored-By: Senem Soy <senem@super.gd> Co-Authored-By: Noah Silvera <noah@super.gd>
1 parent 481d548 commit 218b36b

6 files changed

Lines changed: 180 additions & 118 deletions

File tree

.eslintrc.json

Lines changed: 0 additions & 101 deletions
This file was deleted.

admin/.eslintrc.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

admin/eslint.config.mjs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { defineConfig } from "eslint/config";
2+
import path from "node:path";
3+
import { fileURLToPath } from "node:url";
4+
import js from "@eslint/js";
5+
import { FlatCompat } from "@eslint/eslintrc";
6+
import rootConfig from "../eslint.config.mjs";
7+
8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = path.dirname(__filename);
10+
const compat = new FlatCompat({
11+
baseDirectory: __dirname,
12+
recommendedConfig: js.configs.recommended,
13+
allConfig: js.configs.all
14+
});
15+
16+
export default defineConfig([
17+
...rootConfig,
18+
{
19+
extends: compat.extends("eslint:recommended"),
20+
21+
languageOptions: {
22+
ecmaVersion: 2023,
23+
sourceType: "module",
24+
},
25+
}
26+
]);

eslint.config.mjs

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
import { defineConfig } from "eslint/config";
2+
import globals from "globals";
3+
import path from "node:path";
4+
import { fileURLToPath } from "node:url";
5+
import js from "@eslint/js";
6+
import { FlatCompat } from "@eslint/eslintrc";
7+
8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = path.dirname(__filename);
10+
const compat = new FlatCompat({
11+
baseDirectory: __dirname,
12+
recommendedConfig: js.configs.recommended,
13+
allConfig: js.configs.all
14+
});
15+
16+
export default defineConfig([{
17+
extends: compat.extends("eslint:recommended"),
18+
19+
languageOptions: {
20+
globals: {
21+
...globals.browser,
22+
...globals.jquery,
23+
_: "readonly",
24+
accounting: "readonly",
25+
addVariantFromStockLocation: "writable",
26+
adjustShipmentItems: "writable",
27+
Backbone: "readonly",
28+
error: "writable",
29+
flatpickr: "readonly",
30+
Handlebars: "readonly",
31+
HandlebarsTemplates: "readonly",
32+
json: "writable",
33+
message: "writable",
34+
Select2: "readonly",
35+
shipments: "writable",
36+
show_flash: "writable",
37+
Sortable: "readonly",
38+
Spree: "readonly",
39+
Turbolinks: "readonly",
40+
update_state: "writable",
41+
},
42+
43+
ecmaVersion: 2019,
44+
sourceType: "script",
45+
},
46+
rules: {
47+
"block-scoped-var": 0,
48+
camelcase: 0,
49+
"comma-dangle": 0,
50+
"comma-spacing": 0,
51+
"computed-property-spacing": 0,
52+
"consistent-return": 0,
53+
"default-case": 0,
54+
"dot-notation": 0,
55+
eqeqeq: 0,
56+
"func-names": 0,
57+
"guard-for-in": 0,
58+
indent: 0,
59+
"key-spacing": 0,
60+
"keyword-spacing": 0,
61+
"linebreak-style": ["error", "unix"],
62+
"max-len": 0,
63+
"new-cap": 0,
64+
"no-alert": 0,
65+
"no-bitwise": 0,
66+
67+
"no-console": ["warn", {
68+
allow: ["warn"],
69+
}],
70+
71+
"no-else-return": 0,
72+
"no-extra-semi": "error",
73+
74+
"no-global-assign": ["error", {
75+
exceptions: ["Tabs"],
76+
}],
77+
78+
"no-multi-spaces": 0,
79+
"no-multi-str": 0,
80+
"no-new": 0,
81+
"no-param-reassign": 0,
82+
"no-plusplus": 0,
83+
"no-redeclare": "error",
84+
"no-restricted-globals": 0,
85+
"no-restricted-syntax": 0,
86+
"no-shadow": 0,
87+
"no-undef": "error",
88+
89+
"no-underscore-dangle": ["error", {
90+
allow: ["_sync", "_this", "_flatpickr"],
91+
}],
92+
93+
"no-unused-vars": ["error", {
94+
vars: "all",
95+
args: "none",
96+
}],
97+
98+
"no-use-before-define": 0,
99+
"no-unused-expressions": 0,
100+
"no-var": 0,
101+
"one-var": 0,
102+
"one-var-declaration-per-line": 0,
103+
"object-curly-newline": 0,
104+
"object-curly-spacing": 0,
105+
"object-shorthand": 0,
106+
"operator-linebreak": 0,
107+
"prefer-arrow-callback": 0,
108+
"prefer-destructuring": 0,
109+
"prefer-rest-params": 0,
110+
"prefer-template": 0,
111+
"quote-props": 0,
112+
quotes: 0,
113+
radix: 0,
114+
semi: 0,
115+
"space-before-function-paren": 0,
116+
"space-before-blocks": 0,
117+
"space-infix-ops": 0,
118+
"space-unary-ops": 0,
119+
"spaced-comment": 0,
120+
strict: 0,
121+
"vars-on-top": 0,
122+
"wrap-iife": 0,
123+
},
124+
}]);

promotions/.eslintrc.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

promotions/eslint.config.mjs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { defineConfig } from "eslint/config";
2+
import path from "node:path";
3+
import { fileURLToPath } from "node:url";
4+
import js from "@eslint/js";
5+
import { FlatCompat } from "@eslint/eslintrc";
6+
import rootConfig from "../eslint.config.mjs";
7+
8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = path.dirname(__filename);
10+
const compat = new FlatCompat({
11+
baseDirectory: __dirname,
12+
recommendedConfig: js.configs.recommended,
13+
allConfig: js.configs.all
14+
});
15+
16+
export default defineConfig([
17+
...rootConfig,
18+
{
19+
extends: compat.extends("eslint:recommended"),
20+
21+
languageOptions: {
22+
globals: {
23+
Turbo: "readonly",
24+
},
25+
26+
ecmaVersion: 2023,
27+
sourceType: "module",
28+
},
29+
}
30+
]);

0 commit comments

Comments
 (0)