-
-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy patheslint.config.ts
More file actions
103 lines (94 loc) · 2.93 KB
/
eslint.config.ts
File metadata and controls
103 lines (94 loc) · 2.93 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
97
98
99
100
101
102
103
import { defineConfig } from 'eslint/config';
import js from '@eslint/js';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { FlatCompat } from '@eslint/eslintrc';
import prettier from 'eslint-config-prettier/flat';
import markdown from '@eslint/markdown';
import n from 'eslint-plugin-n';
import tseslint from 'typescript-eslint';
import unicorn from 'eslint-plugin-unicorn';
import eslintComments from '@eslint-community/eslint-plugin-eslint-comments/configs';
import eslintPlugin from './lib/index.ts';
const dirname = path.dirname(fileURLToPath(import.meta.url));
const compat = new FlatCompat({
baseDirectory: dirname,
recommendedConfig: js.configs.recommended,
});
export default defineConfig([
// Global ignores
{
ignores: [
'node_modules',
'coverage',
'dist',
'tests/lib/fixtures',
'e2e/fixtures',
],
},
...compat.extends('not-an-aardvark/node'),
// base config
{
files: ['**/*.{js,ts}'],
languageOptions: { parser: tseslint.parser, sourceType: 'module' },
plugins: { js, n, 'eslint-plugin': eslintPlugin },
extends: [
prettier,
'js/recommended',
tseslint.configs.recommended,
'n/recommended',
unicorn.configs.recommended,
eslintComments.recommended,
],
rules: {
'n/no-missing-import': 'off',
'@eslint-community/eslint-comments/no-unused-disable': 'error',
'@eslint-community/eslint-comments/require-description': 'error',
'unicorn/consistent-function-scoping': 'off',
'unicorn/no-array-callback-reference': 'off',
'unicorn/no-array-for-each': 'off',
'unicorn/no-array-reduce': 'off',
'unicorn/no-null': 'off',
'unicorn/prefer-module': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/no-nested-ternary': 'off',
},
},
{
// Apply eslint-plugin rules to our own rules/tests (but not docs).
files: ['lib/**/*.ts', 'tests/**/*.ts'],
plugins: { 'eslint-plugin': eslintPlugin },
extends: ['eslint-plugin/all'],
rules: {
'eslint-plugin/report-message-format': ['error', '^[^a-z].*.$'],
'eslint-plugin/require-meta-docs-url': [
'error',
{
pattern:
'https://github.com/eslint-community/eslint-plugin-eslint-plugin/tree/HEAD/docs/rules/{{name}}.md',
},
],
},
},
{
files: ['**/*.md'],
plugins: { markdown },
processor: 'markdown/markdown',
},
{
// Markdown JS code samples in documentation:
files: ['**/*.md/*.js', '**/*.md/*.ts'],
plugins: { markdown },
linterOptions: { noInlineConfig: true },
rules: {
strict: 'off',
'no-undef': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@eslint-community/eslint-comments/require-description': 'off',
'n/no-missing-import': 'off',
'unicorn/filename-case': 'off',
},
},
]);