-
Notifications
You must be signed in to change notification settings - Fork 2
/
eslint.config.js
55 lines (50 loc) · 1.72 KB
/
eslint.config.js
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
// @ts-check
import { FlatCompat } from '@eslint/eslintrc'
import eslint from '@eslint/js'
import prettierConfig from 'eslint-config-prettier'
// plugins
import noOnlyTestsEslint from 'eslint-plugin-no-only-tests'
import regexpEslint from 'eslint-plugin-regexp'
import globals from 'globals'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import tseslint from 'typescript-eslint'
const typescriptEslint = tseslint.plugin
// parsers
const typescriptParser = tseslint.parser
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
// ref:
// https://eslint.org/docs/latest/use/configure/migration-guide#using-eslintrc-configs-in-flat-config
// mimic CommonJS variables -- not needed if using CommonJS
const compat = new FlatCompat({ baseDirectory: __dirname })
export default tseslint.config(
eslint.configs.recommended,
...compat
.extends('plugin:regexp/recommended'),
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked, prettierConfig, {
languageOptions: {
parser: typescriptParser,
parserOptions: {
project: ['./tsconfig.eslint.json'],
tsconfigRootDir: __dirname
},
globals: globals.browser
},
plugins: {
'@typescript-eslint': typescriptEslint,
'no-only-tests': noOnlyTestsEslint,
regexp: regexpEslint
}
},
{
ignores: [
'**/*.d.*', '**/*.map.*', 'packages/**/*.min.js',
'packages/**/dist/', 'packages/**/fixtures/',
'packages/astro/vendor/vite/', 'benchmark/**/dist/',
'examples/', 'scripts/', 'megalinter-reports/', '.github/',
'.changeset/', '**/wwwroot/**/*.js',
'eslint.config.js' // TODO: Remove an resolve the issues
]
})