@xylabs/eslint-config-flat 3.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/import/index.d.cts +3 -0
- package/dist/node/import/index.d.cts.map +1 -0
- package/dist/node/import/index.d.mts +3 -0
- package/dist/node/import/index.d.mts.map +1 -0
- package/dist/node/import/index.d.ts +3 -0
- package/dist/node/import/index.d.ts.map +1 -0
- package/dist/node/index.d.cts +4 -0
- package/dist/node/index.d.cts.map +1 -0
- package/dist/node/index.d.mts +4 -0
- package/dist/node/index.d.mts.map +1 -0
- package/dist/node/index.d.ts +4 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +350 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/index.mjs +319 -0
- package/dist/node/index.mjs.map +1 -0
- package/dist/node/json/index.d.cts +3 -0
- package/dist/node/json/index.d.cts.map +1 -0
- package/dist/node/json/index.d.mts +3 -0
- package/dist/node/json/index.d.mts.map +1 -0
- package/dist/node/json/index.d.ts +3 -0
- package/dist/node/json/index.d.ts.map +1 -0
- package/dist/node/markdown/index.d.cts +3 -0
- package/dist/node/markdown/index.d.cts.map +1 -0
- package/dist/node/markdown/index.d.mts +3 -0
- package/dist/node/markdown/index.d.mts.map +1 -0
- package/dist/node/markdown/index.d.ts +3 -0
- package/dist/node/markdown/index.d.ts.map +1 -0
- package/dist/node/prettier/index.d.cts +3 -0
- package/dist/node/prettier/index.d.cts.map +1 -0
- package/dist/node/prettier/index.d.mts +3 -0
- package/dist/node/prettier/index.d.mts.map +1 -0
- package/dist/node/prettier/index.d.ts +3 -0
- package/dist/node/prettier/index.d.ts.map +1 -0
- package/dist/node/rules/index.d.cts +3 -0
- package/dist/node/rules/index.d.cts.map +1 -0
- package/dist/node/rules/index.d.mts +3 -0
- package/dist/node/rules/index.d.mts.map +1 -0
- package/dist/node/rules/index.d.ts +3 -0
- package/dist/node/rules/index.d.ts.map +1 -0
- package/dist/node/typescript/index.d.cts +3 -0
- package/dist/node/typescript/index.d.cts.map +1 -0
- package/dist/node/typescript/index.d.mts +3 -0
- package/dist/node/typescript/index.d.mts.map +1 -0
- package/dist/node/typescript/index.d.ts +3 -0
- package/dist/node/typescript/index.d.ts.map +1 -0
- package/dist/node/unicorn/index.d.cts +3 -0
- package/dist/node/unicorn/index.d.cts.map +1 -0
- package/dist/node/unicorn/index.d.mts +3 -0
- package/dist/node/unicorn/index.d.mts.map +1 -0
- package/dist/node/unicorn/index.d.ts +3 -0
- package/dist/node/unicorn/index.d.ts.map +1 -0
- package/dist/node/workspaces/index.d.cts +3 -0
- package/dist/node/workspaces/index.d.cts.map +1 -0
- package/dist/node/workspaces/index.d.mts +3 -0
- package/dist/node/workspaces/index.d.mts.map +1 -0
- package/dist/node/workspaces/index.d.ts +3 -0
- package/dist/node/workspaces/index.d.ts.map +1 -0
- package/package.json +88 -0
- package/src/import/index.ts +35 -0
- package/src/index.ts +82 -0
- package/src/json/index.ts +11 -0
- package/src/markdown/index.ts +26 -0
- package/src/prettier/index.ts +22 -0
- package/src/rules/index.ts +48 -0
- package/src/typescript/index.ts +113 -0
- package/src/unicorn/index.ts +22 -0
- package/src/workspaces/index.ts +10 -0
- package/tsconfig.json +4 -0
- package/tsconfig.test.json +4 -0
- package/xy.config.ts +9 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ESLint } from 'eslint'
|
|
2
|
+
|
|
3
|
+
export const importConfig: ESLint.ConfigData = {
|
|
4
|
+
extends: ['plugin:import/errors', 'plugin:import/warnings', 'plugin:import/typescript'],
|
|
5
|
+
plugins: ['import', 'simple-import-sort'],
|
|
6
|
+
rules: {
|
|
7
|
+
'import/default': ['off'],
|
|
8
|
+
'import/named': ['off'],
|
|
9
|
+
'import/namespace': ['off'],
|
|
10
|
+
'import/no-absolute-path': ['warn'],
|
|
11
|
+
'import/no-cycle': [
|
|
12
|
+
'warn',
|
|
13
|
+
{
|
|
14
|
+
maxDepth: 2,
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
'import/no-default-export': ['warn'],
|
|
18
|
+
'import/no-deprecated': ['warn'],
|
|
19
|
+
'import/no-internal-modules': ['warn'],
|
|
20
|
+
'import/no-named-as-default': ['warn'],
|
|
21
|
+
'import/no-named-as-default-member': ['off'],
|
|
22
|
+
'import/no-restricted-paths': ['warn'],
|
|
23
|
+
'import/no-self-import': ['warn'],
|
|
24
|
+
'import/no-useless-path-segments': ['warn'],
|
|
25
|
+
'simple-import-sort/exports': ['warn'],
|
|
26
|
+
'simple-import-sort/imports': ['warn'],
|
|
27
|
+
},
|
|
28
|
+
settings: {
|
|
29
|
+
'import/resolver': {
|
|
30
|
+
typescript: {
|
|
31
|
+
alwaysTryTypes: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ESLint } from 'eslint'
|
|
2
|
+
// eslint-disable-next-line import/no-internal-modules
|
|
3
|
+
import compact from 'lodash/compact'
|
|
4
|
+
|
|
5
|
+
import { importConfig } from './import'
|
|
6
|
+
//import { jsonConfig } from './json'
|
|
7
|
+
//import { markdownConfig } from './markdown'
|
|
8
|
+
import { prettierConfig } from './prettier'
|
|
9
|
+
import { rulesConfig } from './rules'
|
|
10
|
+
import { typescriptConfig } from './typescript'
|
|
11
|
+
import { unicornConfig } from './unicorn'
|
|
12
|
+
import { workspacesConfig } from './workspaces'
|
|
13
|
+
|
|
14
|
+
const toArray = <T>(value: T | (T | undefined)[] | undefined): T[] => {
|
|
15
|
+
if (value === undefined) {
|
|
16
|
+
return []
|
|
17
|
+
}
|
|
18
|
+
return Array.isArray(value) ? compact(value) : compact([value])
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const config: ESLint.ConfigData = {
|
|
22
|
+
extends: [
|
|
23
|
+
...toArray(typescriptConfig.extends),
|
|
24
|
+
...toArray(workspacesConfig.extends),
|
|
25
|
+
...toArray(rulesConfig.extends),
|
|
26
|
+
//...toArray(markdownConfig.extends),
|
|
27
|
+
...toArray(importConfig.extends),
|
|
28
|
+
//...toArray(jsonConfig.extends),
|
|
29
|
+
...toArray(prettierConfig.extends),
|
|
30
|
+
...toArray(unicornConfig.extends),
|
|
31
|
+
],
|
|
32
|
+
ignorePatterns: ['node_modules', 'dist', 'bin', 'storybook-static', '.github', '.vscode', '.yarn', 'package.json'],
|
|
33
|
+
overrides: [
|
|
34
|
+
...toArray(typescriptConfig.overrides),
|
|
35
|
+
...toArray(workspacesConfig.overrides),
|
|
36
|
+
...toArray(rulesConfig.overrides),
|
|
37
|
+
//...toArray(markdownConfig.overrides),
|
|
38
|
+
...toArray(importConfig.overrides),
|
|
39
|
+
//...toArray(jsonConfig.overrides),
|
|
40
|
+
...toArray(prettierConfig.overrides),
|
|
41
|
+
...toArray(unicornConfig.overrides),
|
|
42
|
+
],
|
|
43
|
+
plugins: [
|
|
44
|
+
...toArray(typescriptConfig.plugins),
|
|
45
|
+
...toArray(workspacesConfig.plugins),
|
|
46
|
+
...toArray(rulesConfig.plugins),
|
|
47
|
+
//...toArray(markdownConfig.plugins),
|
|
48
|
+
...toArray(importConfig.plugins),
|
|
49
|
+
//...toArray(jsonConfig.plugins),
|
|
50
|
+
...toArray(prettierConfig.plugins),
|
|
51
|
+
...toArray(unicornConfig.plugins),
|
|
52
|
+
],
|
|
53
|
+
rules: {
|
|
54
|
+
...typescriptConfig.rules,
|
|
55
|
+
...workspacesConfig.rules,
|
|
56
|
+
...rulesConfig.rules,
|
|
57
|
+
//...markdownConfig.rules,
|
|
58
|
+
...importConfig.rules,
|
|
59
|
+
//...jsonConfig.rules,
|
|
60
|
+
...prettierConfig.rules,
|
|
61
|
+
...unicornConfig.rules,
|
|
62
|
+
},
|
|
63
|
+
settings: {
|
|
64
|
+
...typescriptConfig.settings,
|
|
65
|
+
...workspacesConfig.settings,
|
|
66
|
+
...rulesConfig.settings,
|
|
67
|
+
//...markdownConfig.settings,
|
|
68
|
+
...importConfig.settings,
|
|
69
|
+
//...jsonConfig.settings,
|
|
70
|
+
...prettierConfig.settings,
|
|
71
|
+
...unicornConfig.settings,
|
|
72
|
+
},
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* We use export default to make the type generation correct */
|
|
76
|
+
|
|
77
|
+
// eslint-disable-next-line import/no-default-export
|
|
78
|
+
export default config
|
|
79
|
+
|
|
80
|
+
/* We use module.exports to make the plugin load work */
|
|
81
|
+
|
|
82
|
+
module.exports = config
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ESLint } from 'eslint'
|
|
2
|
+
|
|
3
|
+
export const markdownConfig: ESLint.ConfigData = {
|
|
4
|
+
extends: ['plugin:md/recommended'],
|
|
5
|
+
overrides: [
|
|
6
|
+
{
|
|
7
|
+
files: ['*.md'],
|
|
8
|
+
parser: 'markdown-eslint-parser',
|
|
9
|
+
rules: {
|
|
10
|
+
'md/remark': [
|
|
11
|
+
'warn',
|
|
12
|
+
{
|
|
13
|
+
plugins: ['preset-lint-markdown-style-guide', 'frontmatter', ['lint-list-item-indent', 'tab-size']],
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
'prettier/prettier': [
|
|
17
|
+
'off',
|
|
18
|
+
// Important to force prettier to use "markdown" parser - otherwise it wouldn't be able to parse *.md files.
|
|
19
|
+
// You also can configure other options supported by prettier here - "prose-wrap" is
|
|
20
|
+
// particularly useful for *.md files
|
|
21
|
+
{ parser: 'markdown' },
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ESLint } from 'eslint'
|
|
2
|
+
|
|
3
|
+
export const prettierConfig: ESLint.ConfigData = {
|
|
4
|
+
extends: ['plugin:prettier/recommended'],
|
|
5
|
+
plugins: ['prettier'],
|
|
6
|
+
rules: {
|
|
7
|
+
'prettier/prettier': [
|
|
8
|
+
'warn',
|
|
9
|
+
{
|
|
10
|
+
bracketSpacing: true,
|
|
11
|
+
endOfLine: 'lf',
|
|
12
|
+
experimentalTernaries: true,
|
|
13
|
+
printWidth: 150,
|
|
14
|
+
semi: false,
|
|
15
|
+
singleQuote: true,
|
|
16
|
+
tabWidth: 2,
|
|
17
|
+
trailingComma: 'all',
|
|
18
|
+
useTabs: false,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ESLint } from 'eslint'
|
|
2
|
+
|
|
3
|
+
export const rulesConfig: ESLint.ConfigData = {
|
|
4
|
+
extends: ['plugin:deprecation/recommended'],
|
|
5
|
+
plugins: ['sort-keys-fix', 'no-secrets'],
|
|
6
|
+
rules: {
|
|
7
|
+
complexity: ['error', 18],
|
|
8
|
+
'deprecation/deprecation': ['warn'],
|
|
9
|
+
'max-depth': ['error', 6],
|
|
10
|
+
'max-lines': [
|
|
11
|
+
'error',
|
|
12
|
+
{
|
|
13
|
+
max: 512,
|
|
14
|
+
skipBlankLines: true,
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
'max-nested-callbacks': ['error', 6],
|
|
18
|
+
'max-statements': ['error', 32],
|
|
19
|
+
'no-restricted-imports': [
|
|
20
|
+
'warn',
|
|
21
|
+
{
|
|
22
|
+
paths: [
|
|
23
|
+
'lodash',
|
|
24
|
+
'react-player',
|
|
25
|
+
'filepond',
|
|
26
|
+
'aos',
|
|
27
|
+
'react-icons',
|
|
28
|
+
'.',
|
|
29
|
+
'..',
|
|
30
|
+
'../..',
|
|
31
|
+
'../../..',
|
|
32
|
+
'../../../..',
|
|
33
|
+
'../../../../..',
|
|
34
|
+
'../../../../../..',
|
|
35
|
+
'../../../../../../..',
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
'no-secrets/no-secrets': ['off'],
|
|
40
|
+
'no-tabs': ['error'],
|
|
41
|
+
'no-unused-vars': 'off',
|
|
42
|
+
'no-useless-escape': 'off',
|
|
43
|
+
quotes: [2, 'single', 'avoid-escape'],
|
|
44
|
+
'require-await': 'error',
|
|
45
|
+
semi: ['warn', 'never'],
|
|
46
|
+
'sort-keys-fix/sort-keys-fix': 'warn',
|
|
47
|
+
},
|
|
48
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { ESLint } from 'eslint'
|
|
2
|
+
|
|
3
|
+
export const typescriptConfig: ESLint.ConfigData = {
|
|
4
|
+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
|
|
5
|
+
overrides: [
|
|
6
|
+
{
|
|
7
|
+
files: ['*.ts*', '*.d.ts*'],
|
|
8
|
+
parser: '@typescript-eslint/parser',
|
|
9
|
+
parserOptions: { ecmaVersion: 'latest', project: ['./tsconfig.json'], tsconfigRootDir: __dirname },
|
|
10
|
+
plugins: ['@typescript-eslint'],
|
|
11
|
+
rules: {
|
|
12
|
+
'@typescript-eslint/explicit-member-accessibility': ['warn', { accessibility: 'no-public' }],
|
|
13
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
14
|
+
'@typescript-eslint/member-delimiter-style': [
|
|
15
|
+
'error',
|
|
16
|
+
{
|
|
17
|
+
multiline: {
|
|
18
|
+
delimiter: 'none',
|
|
19
|
+
requireLast: true,
|
|
20
|
+
},
|
|
21
|
+
singleline: {
|
|
22
|
+
delimiter: 'semi',
|
|
23
|
+
requireLast: false,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
'@typescript-eslint/member-ordering': [
|
|
28
|
+
'warn',
|
|
29
|
+
{
|
|
30
|
+
default: {
|
|
31
|
+
memberTypes: [
|
|
32
|
+
'signature',
|
|
33
|
+
'call-signature',
|
|
34
|
+
'public-static-field',
|
|
35
|
+
'protected-static-field',
|
|
36
|
+
'private-static-field',
|
|
37
|
+
'public-decorated-field',
|
|
38
|
+
'protected-decorated-field',
|
|
39
|
+
'private-decorated-field',
|
|
40
|
+
'public-instance-field',
|
|
41
|
+
'protected-instance-field',
|
|
42
|
+
'private-instance-field',
|
|
43
|
+
'public-abstract-field',
|
|
44
|
+
'protected-abstract-field',
|
|
45
|
+
'public-field',
|
|
46
|
+
'protected-field',
|
|
47
|
+
'private-field',
|
|
48
|
+
'static-field',
|
|
49
|
+
'instance-field',
|
|
50
|
+
'abstract-field',
|
|
51
|
+
'decorated-field',
|
|
52
|
+
'field',
|
|
53
|
+
'public-constructor',
|
|
54
|
+
'protected-constructor',
|
|
55
|
+
'private-constructor',
|
|
56
|
+
'constructor',
|
|
57
|
+
['public-static-get', 'public-static-set'],
|
|
58
|
+
['protected-static-get', 'protected-static-set'],
|
|
59
|
+
['private-static-get', 'private-static-set'],
|
|
60
|
+
['public-decorated-get', 'public-decorated-set'],
|
|
61
|
+
['protected-decorated-get', 'protected-decorated-set'],
|
|
62
|
+
['private-decorated-get', 'private-decorated-set'],
|
|
63
|
+
['public-instance-get', 'public-instance-set'],
|
|
64
|
+
['protected-instance-get', 'protected-instance-set'],
|
|
65
|
+
['private-instance-get', 'private-instance-set'],
|
|
66
|
+
['public-abstract-get', 'public-abstract-set'],
|
|
67
|
+
['protected-abstract-get', 'protected-abstract-set'],
|
|
68
|
+
['public-get', 'public-set'],
|
|
69
|
+
['protected-get', 'protected-set'],
|
|
70
|
+
['private-get', 'private-set'],
|
|
71
|
+
['static-get', 'static-set'],
|
|
72
|
+
['instance-get', 'instance-set'],
|
|
73
|
+
['abstract-get', 'abstract-set'],
|
|
74
|
+
['decorated-get', 'decorated-set'],
|
|
75
|
+
'get',
|
|
76
|
+
'set',
|
|
77
|
+
'public-static-method',
|
|
78
|
+
'protected-static-method',
|
|
79
|
+
'private-static-method',
|
|
80
|
+
'public-decorated-method',
|
|
81
|
+
'protected-decorated-method',
|
|
82
|
+
'private-decorated-method',
|
|
83
|
+
'public-instance-method',
|
|
84
|
+
'protected-instance-method',
|
|
85
|
+
'private-instance-method',
|
|
86
|
+
'public-abstract-method',
|
|
87
|
+
'protected-abstract-method',
|
|
88
|
+
'public-method',
|
|
89
|
+
'protected-method',
|
|
90
|
+
'private-method',
|
|
91
|
+
'static-method',
|
|
92
|
+
'instance-method',
|
|
93
|
+
'abstract-method',
|
|
94
|
+
'decorated-method',
|
|
95
|
+
'method',
|
|
96
|
+
],
|
|
97
|
+
order: 'alphabetically',
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
'@typescript-eslint/no-floating-promises': 'error',
|
|
102
|
+
'@typescript-eslint/no-misused-promises': 'error',
|
|
103
|
+
'@typescript-eslint/no-unused-vars': [
|
|
104
|
+
'warn',
|
|
105
|
+
{
|
|
106
|
+
argsIgnorePattern: '^_',
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
'@typescript-eslint/semi': ['warn', 'never'],
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ESLint } from 'eslint'
|
|
2
|
+
|
|
3
|
+
export const unicornConfig: ESLint.ConfigData = {
|
|
4
|
+
env: {
|
|
5
|
+
es2024: true,
|
|
6
|
+
},
|
|
7
|
+
extends: ['plugin:unicorn/recommended'],
|
|
8
|
+
rules: {
|
|
9
|
+
'unicorn/catch-error-name': ['off'],
|
|
10
|
+
'unicorn/consistent-function-scoping': ['off'],
|
|
11
|
+
'unicorn/filename-case': ['off'],
|
|
12
|
+
'unicorn/new-for-builtins': ['off'],
|
|
13
|
+
'unicorn/no-array-callback-reference': ['off'],
|
|
14
|
+
'unicorn/no-await-expression-member': ['off'],
|
|
15
|
+
'unicorn/no-nested-ternary': ['off'],
|
|
16
|
+
'unicorn/no-null': ['off'],
|
|
17
|
+
'unicorn/number-literal-case': ['off'],
|
|
18
|
+
'unicorn/prefer-module': ['off'],
|
|
19
|
+
'unicorn/prefer-top-level-await': ['off'],
|
|
20
|
+
'unicorn/prevent-abbreviations': ['off'],
|
|
21
|
+
},
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ESLint } from 'eslint'
|
|
2
|
+
|
|
3
|
+
export const workspacesConfig: ESLint.ConfigData = {
|
|
4
|
+
extends: ['plugin:workspaces/recommended'],
|
|
5
|
+
plugins: ['workspaces'],
|
|
6
|
+
rules: {
|
|
7
|
+
'workspaces/no-relative-imports': ['off'],
|
|
8
|
+
'workspaces/require-dependency': ['off'],
|
|
9
|
+
},
|
|
10
|
+
}
|
package/tsconfig.json
ADDED