Repository navigation
Expand file tree
/
Copy patheslint.config.js
More file actions
44 lines (43 loc) · 2.07 KB
/
Copy patheslint.config.js
File metadata and controls
44 lines (43 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// ESLint flat config — the repo's JS style gate (`npm run lint`, run first by `npm test` and CI).
// Rules: eslint's `recommended` set, plus the handful below that encode this codebase's own
// conventions (4-space indent, double quotes, semicolons, no `var`). Source files are browser ES
// modules and see browser globals only; tests and the build/lint scripts run under node and see
// node globals only.
import js from "@eslint/js";
import globals from "globals";
export default [
js.configs.recommended,
{ ignores: ["dist/", "node_modules/", "viewer_out/", "group-viewer-out/", "store/", ".venv/"] },
{
files: ["**/*.js", "**/*.mjs"],
languageOptions: {
ecmaVersion: 2022,
sourceType: "module",
},
rules: {
// Blocks step by 4. Continuation lines of a wrapped call/array/object/parameter list
// are left to the author (the codebase aligns matrices and long literals visually),
// and comment columns are free.
"indent": ["error", 4, {
SwitchCase: 1, ignoreComments: true,
ArrayExpression: "off", ObjectExpression: "off", CallExpression: { arguments: "off" },
FunctionDeclaration: { parameters: "off" }, FunctionExpression: { parameters: "off" },
}],
"quotes": ["error", "double", { avoidEscape: true, allowTemplateLiterals: true }],
"semi": ["error", "always"],
"no-var": "error",
"prefer-const": "error",
"eqeqeq": ["error", "always", { null: "ignore" }],
// `_x` names mark deliberately-unused parameters (the adapter contract's stubs).
"no-unused-vars": ["error", { argsIgnorePattern: "^_", caughtErrors: "none" }],
},
},
{
files: ["core/**/*.js", "ui/**/*.js", "adapter/**/*.js", "index.js", "draw-pipeline.js", "io.js"],
languageOptions: { globals: globals.browser },
},
{
files: ["test/**/*.js", "build.mjs", "eslint.config.js"],
languageOptions: { globals: globals.node },
},
];