@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.
Files changed (71) hide show
  1. package/dist/node/import/index.d.cts +3 -0
  2. package/dist/node/import/index.d.cts.map +1 -0
  3. package/dist/node/import/index.d.mts +3 -0
  4. package/dist/node/import/index.d.mts.map +1 -0
  5. package/dist/node/import/index.d.ts +3 -0
  6. package/dist/node/import/index.d.ts.map +1 -0
  7. package/dist/node/index.d.cts +4 -0
  8. package/dist/node/index.d.cts.map +1 -0
  9. package/dist/node/index.d.mts +4 -0
  10. package/dist/node/index.d.mts.map +1 -0
  11. package/dist/node/index.d.ts +4 -0
  12. package/dist/node/index.d.ts.map +1 -0
  13. package/dist/node/index.js +350 -0
  14. package/dist/node/index.js.map +1 -0
  15. package/dist/node/index.mjs +319 -0
  16. package/dist/node/index.mjs.map +1 -0
  17. package/dist/node/json/index.d.cts +3 -0
  18. package/dist/node/json/index.d.cts.map +1 -0
  19. package/dist/node/json/index.d.mts +3 -0
  20. package/dist/node/json/index.d.mts.map +1 -0
  21. package/dist/node/json/index.d.ts +3 -0
  22. package/dist/node/json/index.d.ts.map +1 -0
  23. package/dist/node/markdown/index.d.cts +3 -0
  24. package/dist/node/markdown/index.d.cts.map +1 -0
  25. package/dist/node/markdown/index.d.mts +3 -0
  26. package/dist/node/markdown/index.d.mts.map +1 -0
  27. package/dist/node/markdown/index.d.ts +3 -0
  28. package/dist/node/markdown/index.d.ts.map +1 -0
  29. package/dist/node/prettier/index.d.cts +3 -0
  30. package/dist/node/prettier/index.d.cts.map +1 -0
  31. package/dist/node/prettier/index.d.mts +3 -0
  32. package/dist/node/prettier/index.d.mts.map +1 -0
  33. package/dist/node/prettier/index.d.ts +3 -0
  34. package/dist/node/prettier/index.d.ts.map +1 -0
  35. package/dist/node/rules/index.d.cts +3 -0
  36. package/dist/node/rules/index.d.cts.map +1 -0
  37. package/dist/node/rules/index.d.mts +3 -0
  38. package/dist/node/rules/index.d.mts.map +1 -0
  39. package/dist/node/rules/index.d.ts +3 -0
  40. package/dist/node/rules/index.d.ts.map +1 -0
  41. package/dist/node/typescript/index.d.cts +3 -0
  42. package/dist/node/typescript/index.d.cts.map +1 -0
  43. package/dist/node/typescript/index.d.mts +3 -0
  44. package/dist/node/typescript/index.d.mts.map +1 -0
  45. package/dist/node/typescript/index.d.ts +3 -0
  46. package/dist/node/typescript/index.d.ts.map +1 -0
  47. package/dist/node/unicorn/index.d.cts +3 -0
  48. package/dist/node/unicorn/index.d.cts.map +1 -0
  49. package/dist/node/unicorn/index.d.mts +3 -0
  50. package/dist/node/unicorn/index.d.mts.map +1 -0
  51. package/dist/node/unicorn/index.d.ts +3 -0
  52. package/dist/node/unicorn/index.d.ts.map +1 -0
  53. package/dist/node/workspaces/index.d.cts +3 -0
  54. package/dist/node/workspaces/index.d.cts.map +1 -0
  55. package/dist/node/workspaces/index.d.mts +3 -0
  56. package/dist/node/workspaces/index.d.mts.map +1 -0
  57. package/dist/node/workspaces/index.d.ts +3 -0
  58. package/dist/node/workspaces/index.d.ts.map +1 -0
  59. package/package.json +88 -0
  60. package/src/import/index.ts +35 -0
  61. package/src/index.ts +82 -0
  62. package/src/json/index.ts +11 -0
  63. package/src/markdown/index.ts +26 -0
  64. package/src/prettier/index.ts +22 -0
  65. package/src/rules/index.ts +48 -0
  66. package/src/typescript/index.ts +113 -0
  67. package/src/unicorn/index.ts +22 -0
  68. package/src/workspaces/index.ts +10 -0
  69. package/tsconfig.json +4 -0
  70. package/tsconfig.test.json +4 -0
  71. 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,11 @@
1
+ import { ESLint } from 'eslint'
2
+
3
+ export const jsonConfig: ESLint.ConfigData = {
4
+ overrides: [
5
+ {
6
+ extends: 'plugin:jsonc/recommended-with-jsonc',
7
+ files: ['*.json'],
8
+ parser: 'jsonc-eslint-parser',
9
+ },
10
+ ],
11
+ }
@@ -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
@@ -0,0 +1,4 @@
1
+ {
2
+ "exclude": ["dist", "docs", "node_modules"],
3
+ "extends": "@xylabs/tsconfig"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "include": ["**/*.spec.ts"]
4
+ }
package/xy.config.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
2
+ const config: XyTsupConfig = {
3
+ compile: {
4
+ browser: {},
5
+ },
6
+ }
7
+
8
+ // eslint-disable-next-line import/no-default-export
9
+ export default config