-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
96 lines (90 loc) · 2.8 KB
/
Copy patheslint.config.mjs
File metadata and controls
96 lines (90 loc) · 2.8 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
91
92
93
94
95
96
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { createRequire } from 'node:module';
import css from '@eslint/css';
const require = createRequire(import.meta.url);
// Resolve ESLint's own dependency tree so this works even when these
// packages are not direct dependencies in package.json.
const eslintPackageJsonPath = require.resolve('eslint/package.json');
const eslintRequire = createRequire(eslintPackageJsonPath);
const { FlatCompat } = eslintRequire('@eslint/eslintrc');
const js = eslintRequire('@eslint/js');
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
});
export default [
{
ignores: ['dist/**/*', 'node_modules/**/*', '.astro/**/*', '.wrangler/**/*'],
},
{
files: ['**/*.css'],
plugins: {
css,
},
language: 'css/css',
rules: {
'css/use-baseline': ['warn', { available: 'newly' }],
},
},
...compat
.config({
env: {
node: true,
browser: true,
es2022: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:astro/recommended',
'plugin:jsx-a11y/recommended',
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.json',
},
plugins: ['@typescript-eslint', 'jsx-a11y', 'prettier'],
rules: {
'prettier/prettier': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-explicit-any': 'error',
},
overrides: [
{
files: ['*.astro'],
parser: 'astro-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
extraFileExtensions: ['.astro'],
},
rules: {
'astro/no-set-html-directive': 'error',
'@typescript-eslint/no-unused-vars': 'off',
'jsx-a11y/html-has-lang': 'off',
// eslint-plugin-jsx-a11y が Astro lint 時に minimatch 互換で落ちるため無効化
'jsx-a11y/label-has-associated-control': 'off',
// Prettierのルールを緩和
'prettier/prettier': 'warn',
},
},
{
files: ['src/env.d.ts'],
rules: {
'@typescript-eslint/triple-slash-reference': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
},
],
})
.map((config) => ({
...config,
ignores: [...(config.ignores ?? []), '**/*.css'],
})),
];