-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
eslint.config.js
90 lines (80 loc) · 2.26 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
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
import process from 'node:process';
import { setup } from '@skyra/env-utilities';
import safeql from '@ts-safeql/eslint-plugin/config';
import common from 'eslint-config-neon/flat/common.js';
import node from 'eslint-config-neon/flat/node.js';
import prettier from 'eslint-config-neon/flat/prettier.js';
import typescript from 'eslint-config-neon/flat/typescript.js';
import isCI from 'is-ci';
import merge from 'lodash.merge';
setup({ path: new URL('.env', import.meta.url) });
const commonFiles = '{js,mjs,cjs,ts,mts,cts,jsx,tsx}';
const commonRuleset = merge(...common, { files: [`**/*${commonFiles}`] });
const nodeRuleset = merge(...node, { files: [`**/*${commonFiles}`] });
const typeScriptRuleset = merge(...typescript, {
files: [`**/*${commonFiles}`],
languageOptions: {
parserOptions: {
warnOnUnsupportedTypeScriptVersion: false,
allowAutomaticSingleRunInference: true,
project: ['tsconfig.eslint.json'],
},
},
rules: {
'@typescript-eslint/consistent-type-definitions': [2, 'interface'],
'@typescript-eslint/dot-notation': 0,
'import/order': [
1,
{
alphabetize: {
caseInsensitive: false,
order: 'asc',
},
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
'newlines-between': 'never',
},
],
'tsdoc/syntax': 0,
},
settings: {
'import/resolver': {
typescript: {
project: ['tsconfig.eslint.json', 'tests/tsconfig.json'],
},
},
},
});
const prettierRuleset = merge(...prettier, { files: [`**/*${commonFiles}`] });
/** @type {import('eslint').Linter.FlatConfig} */
const safeqlRuleset = {
...safeql.configs.connections({
connectionUrl: process.env.POSTGRES_URL,
migrationsDir: './prisma/migrations',
targets: [{ tag: '**prisma.+($queryRaw|$executeRaw)', transform: '{type}[]' }],
overrides: {},
}),
files: [`**/*${commonFiles}`],
languageOptions: {
parserOptions: {
project: ['tsconfig.eslint.json'],
},
},
};
/** @type {import('eslint').Linter.FlatConfig[]} */
const rules = [
{
ignores: ['**/node_modules/', '.git/', '**/dist/', '**/coverage/'],
},
commonRuleset,
nodeRuleset,
typeScriptRuleset,
{
files: ['**/*{ts,mts,cts,tsx}'],
rules: { 'jsdoc/no-undefined-types': 0 },
},
prettierRuleset,
];
if (!isCI) {
rules.push(safeqlRuleset);
}
export default rules;