Repository navigation
Expand file tree
/
Copy patheslint.config.mjs
More file actions
64 lines (59 loc) · 2.32 KB
/
Copy patheslint.config.mjs
File metadata and controls
64 lines (59 loc) · 2.32 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// =============================================================================
// eslint.config.mjs — flat config (ESLint 9+).
// =============================================================================
//
// Scope is JavaScript only: the node:test suite under tst/, the config
// files at the root, and any plain .js/.mjs that ships to a browser (exe/,
// src/). Linting the TypeScript (src/ts/, the stories, .storybook/,
// vite.config.ts) would need typescript-eslint, and the package has no other
// reason to carry it: `npm run typecheck` already runs tsc over all of it in
// strict mode. The SCSS is stylelint's business, not ESLint's.
//
// Real mistakes only. Layout is Prettier's, so eslint-config-prettier goes
// last and turns off every rule that would argue with it.
// =============================================================================
import js from "@eslint/js";
import prettier from "eslint-config-prettier";
import { defineConfig, globalIgnores } from "eslint/config";
import globals from "globals";
export default defineConfig([
globalIgnores([
".vite/",
"coverage/",
"dist/",
"node_modules/",
"storybook-static/",
// The source fonts and the logo; nothing in it is ours to lint.
"res/",
"Claude outputs/",
]),
{
files: ["**/*.{js,mjs,cjs}"],
extends: [js.configs.recommended],
languageOptions: {
ecmaVersion: 2022,
sourceType: "module",
// Node by default: the tests, and the config files the tools
// load. The browser side is the block below.
globals: globals.node,
},
rules: {
"no-var": "error",
"no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
"no-self-compare": "error",
"no-template-curly-in-string": "warn",
"no-nested-ternary": "warn",
},
},
{
// Whatever runs in a page rather than in Node: a demo under exe/,
// or a plain-JS module under src/. No `process` there.
files: ["exe/**/*.{js,mjs}", "src/**/*.{js,mjs}"],
languageOptions: { globals: globals.browser },
},
// Must stay last: turns off everything that fights Prettier.
prettier,
]);