This repository was archived by the owner on Nov 26, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
90 lines (86 loc) · 2.71 KB
/
Copy patheslint.config.js
File metadata and controls
90 lines (86 loc) · 2.71 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/** See <stanPath>/system/stan.project.md for global & cross‑cutting requirements. */
/* eslint-env node */
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import jsonc from 'eslint-plugin-jsonc';
import jsoncParser from 'jsonc-eslint-parser';
import prettierPlugin from 'eslint-plugin-prettier';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import tsdoc from 'eslint-plugin-tsdoc';
import vitest from '@vitest/eslint-plugin';
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const tsconfigRootDir = dirname(fileURLToPath(import.meta.url));
/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
// Ignore generated and third‑party artifacts
{
ignores: [
'dist/**',
'.rollup.cache/**',
'coverage/**',
'node_modules/**',
'docs/**',
'rollup.config-*.mjs',
'.stan/**',
],
},
// Base JS
eslint.configs.recommended,
// TypeScript (type-aware under src/**)
...tseslint.configs.recommendedTypeChecked.map((c) => ({
...c,
files: ['src/**/*.ts', 'src/**/*.tsx'],
languageOptions: {
...c.languageOptions,
parserOptions: {
...(c.languageOptions?.parserOptions ?? {}),
project: ['./tsconfig.json'],
tsconfigRootDir,
},
},
plugins: {
...(c.plugins ?? {}),
prettier: prettierPlugin,
'simple-import-sort': simpleImportSort,
tsdoc,
},
rules: {
...(c.rules ?? {}),
// Defer to the repo Prettier config (.prettierrc.json) as the single source of truth.
'prettier/prettier': 'error',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
// Our TS preferences
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
// Quieter tsdoc syntax checks (we fix the worst offenders in-source)
'tsdoc/syntax': 'warn',
},
})),
// Tests
{
files: ['**/*.test.ts', '**/*.test.tsx'],
plugins: { vitest },
languageOptions: {
globals: vitest.environments.env.globals,
},
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
// Tests/mocks often return Promises or use async wrappers without awaits.
// Avoid busywork fixes; require-await adds little value in tests.
'@typescript-eslint/require-await': 'off',
},
},
// JSON (no nested extends)
{
files: ['**/*.json'],
languageOptions: { parser: jsoncParser },
plugins: { jsonc },
rules: {
...(jsonc.configs['recommended-with-json'].rules ?? {}),
},
},
];