@trigen/oxlint-config 9.0.0

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.
@@ -0,0 +1,76 @@
1
+ /**
2
+ * ReactJS config
3
+ */
4
+
5
+ import {
6
+ jsxFiles,
7
+ reactFiles
8
+ } from './files.js'
9
+
10
+ export default {
11
+ overrides: [
12
+ {
13
+ files: jsxFiles,
14
+ rules: {
15
+ 'jsdoc/require-param': 'off',
16
+ 'jsdoc/require-returns': 'off'
17
+ }
18
+ },
19
+ {
20
+ files: reactFiles,
21
+ plugins: ['react'],
22
+ rules: {
23
+ // React
24
+ 'react/no-array-index-key': 'warn',
25
+ 'react/no-children-prop': 'error',
26
+ 'react/no-danger': 'warn',
27
+ 'react/no-danger-with-children': 'error',
28
+ 'react/no-did-mount-set-state': 'error',
29
+ 'react/no-did-update-set-state': 'error',
30
+ 'react/no-direct-mutation-state': 'error',
31
+ 'react/no-find-dom-node': 'error',
32
+ 'react/no-is-mounted': 'error',
33
+ 'react/no-multi-comp': [
34
+ 'error',
35
+ {
36
+ ignoreStateless: true
37
+ }
38
+ ],
39
+ 'react/no-redundant-should-component-update': 'error',
40
+ 'react/no-render-return-value': 'error',
41
+ 'react/no-string-refs': 'error',
42
+ 'react/no-this-in-sfc': 'error',
43
+ 'react/no-unescaped-entities': 'error',
44
+ 'react/no-unknown-property': 'error',
45
+ 'react/no-unsafe': 'error',
46
+ 'react/no-will-update-set-state': 'error',
47
+ 'react/prefer-es6-class': 'error',
48
+ 'react/react-in-jsx-scope': 'off',
49
+ 'react/require-render-return': 'error',
50
+ 'react/self-closing-comp': 'error',
51
+ 'react/style-prop-object': 'error',
52
+ 'react/void-dom-elements-no-children': 'error',
53
+
54
+ // Hooks
55
+ 'react/rules-of-hooks': 'error',
56
+ 'react/exhaustive-deps': 'warn',
57
+
58
+ // JSX
59
+ 'react/jsx-boolean-value': 'error',
60
+ 'react/jsx-fragments': 'error',
61
+ 'react/jsx-key': 'error',
62
+ 'react/jsx-no-comment-textnodes': 'error',
63
+ 'react/jsx-no-duplicate-props': 'error',
64
+ 'react/jsx-no-script-url': 'error',
65
+ 'react/jsx-no-target-blank': [
66
+ 'error',
67
+ {
68
+ enforceDynamicLinks: 'always'
69
+ }
70
+ ],
71
+ 'react/jsx-no-undef': 'error',
72
+ 'react/jsx-no-useless-fragment': 'error'
73
+ }
74
+ }
75
+ ]
76
+ }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * React stylistic config
3
+ */
4
+
5
+ import { reactFiles } from './files.js'
6
+
7
+ export default {
8
+ overrides: [
9
+ {
10
+ files: reactFiles,
11
+ plugins: ['react'],
12
+ jsPlugins: [
13
+ {
14
+ name: 'stylistic-js',
15
+ specifier: '@stylistic/eslint-plugin'
16
+ }
17
+ ],
18
+ rules: {
19
+ 'stylistic-js/jsx-child-element-spacing': 'error',
20
+ 'stylistic-js/jsx-closing-bracket-location': 'error',
21
+ 'stylistic-js/jsx-closing-tag-location': 'error',
22
+ 'react/jsx-curly-brace-presence': ['error', 'never'],
23
+ 'stylistic-js/jsx-curly-newline': 'error',
24
+ 'stylistic-js/jsx-curly-spacing': 'error',
25
+ 'stylistic-js/jsx-equals-spacing': 'error',
26
+ 'stylistic-js/jsx-first-prop-new-line': ['error', 'multiline'],
27
+ 'stylistic-js/jsx-function-call-newline': ['error', 'always'],
28
+ 'stylistic-js/jsx-indent-props': ['error', 2],
29
+ 'stylistic-js/jsx-max-props-per-line': [
30
+ 'error',
31
+ {
32
+ maximum: 1
33
+ }
34
+ ],
35
+ 'stylistic-js/jsx-one-expression-per-line': [
36
+ 'error',
37
+ {
38
+ allow: 'literal'
39
+ }
40
+ ],
41
+ 'react/jsx-pascal-case': 'error',
42
+ 'stylistic-js/jsx-self-closing-comp': 'error',
43
+ 'stylistic-js/jsx-tag-spacing': [
44
+ 'error',
45
+ {
46
+ closingSlash: 'never',
47
+ beforeSelfClosing: 'never',
48
+ afterOpening: 'never'
49
+ }
50
+ ],
51
+ 'stylistic-js/jsx-wrap-multilines': [
52
+ 'error',
53
+ {
54
+ declaration: 'parens-new-line',
55
+ assignment: 'parens-new-line',
56
+ return: 'parens-new-line',
57
+ arrow: 'parens-new-line',
58
+ condition: 'parens-new-line',
59
+ logical: 'parens-new-line',
60
+ prop: 'parens-new-line'
61
+ }
62
+ ]
63
+ }
64
+ }
65
+ ]
66
+ }
@@ -0,0 +1,71 @@
1
+ /**
2
+ * TypeScript type checked config
3
+ */
4
+
5
+ import typescriptConfig from './typescript.js'
6
+ import { tsFiles } from './files.js'
7
+
8
+ export default {
9
+ extends: [typescriptConfig],
10
+ overrides: [
11
+ {
12
+ files: tsFiles,
13
+ plugins: ['typescript'],
14
+ rules: {
15
+ // Recommended type checked
16
+ 'typescript/no-array-delete': 'error',
17
+ 'typescript/no-base-to-string': 'error',
18
+ 'typescript/no-duplicate-type-constituents': 'error',
19
+ 'typescript/no-floating-promises': 'error',
20
+ 'typescript/no-for-in-array': 'error',
21
+ 'eslint/no-implied-eval': 'off',
22
+ 'typescript/no-implied-eval': 'error',
23
+ 'typescript/no-misused-promises': 'error',
24
+ 'typescript/no-redundant-type-constituents': 'error',
25
+ 'typescript/no-unnecessary-type-assertion': 'error',
26
+ 'typescript/no-unsafe-argument': 'error',
27
+ 'typescript/no-unsafe-assignment': 'error',
28
+ 'typescript/no-unsafe-call': 'error',
29
+ 'typescript/no-unsafe-enum-comparison': 'error',
30
+ 'typescript/no-unsafe-member-access': 'error',
31
+ 'typescript/no-unsafe-return': 'error',
32
+ 'typescript/no-unsafe-unary-minus': 'error',
33
+ 'eslint/no-throw-literal': 'off',
34
+ 'typescript/only-throw-error': 'error',
35
+ 'eslint/prefer-promise-reject-errors': 'off',
36
+ 'typescript/prefer-promise-reject-errors': 'error',
37
+ 'eslint/require-await': 'off',
38
+ 'typescript/require-await': 'error',
39
+ 'typescript/restrict-plus-operands': 'error',
40
+ 'typescript/restrict-template-expressions': 'error',
41
+ 'typescript/unbound-method': [
42
+ 'off',
43
+ {
44
+ ignoreStatic: true
45
+ }
46
+ ],
47
+
48
+ // Rules
49
+ 'typescript/no-deprecated': 'error',
50
+ 'typescript/no-misused-spread': 'error',
51
+ 'typescript/no-mixed-enums': 'error',
52
+ 'typescript/no-unnecessary-boolean-literal-compare': 'error',
53
+ 'typescript/no-unnecessary-qualifier': 'error',
54
+ 'typescript/no-unnecessary-template-expression': 'error',
55
+ 'typescript/no-unnecessary-type-arguments': 'error',
56
+ 'typescript/consistent-type-imports': 'error',
57
+ 'eslint/dot-notation': 'off',
58
+ 'typescript/dot-notation': 'error',
59
+ 'typescript/prefer-includes': 'error',
60
+ 'typescript/prefer-nullish-coalescing': 'off',
61
+ 'typescript/prefer-optional-chain': 'error',
62
+ 'typescript/prefer-readonly': 'error',
63
+ 'typescript/prefer-readonly-parameter-types': 'off',
64
+ 'typescript/prefer-reduce-type-parameter': 'error',
65
+ 'typescript/prefer-return-this-type': 'error',
66
+ 'typescript/prefer-string-starts-ends-with': 'error',
67
+ 'typescript/switch-exhaustiveness-check': 'error'
68
+ }
69
+ }
70
+ ]
71
+ }
@@ -0,0 +1,175 @@
1
+ /**
2
+ * TypeScript config
3
+ */
4
+
5
+ import {
6
+ dtsFiles,
7
+ tsFiles
8
+ } from './files.js'
9
+
10
+ export default {
11
+ overrides: [
12
+ {
13
+ files: tsFiles,
14
+ plugins: ['typescript'],
15
+ jsPlugins: [
16
+ {
17
+ name: 'trigen',
18
+ specifier: '@trigen/oxlint-config/plugin'
19
+ }
20
+ ],
21
+ rules: {
22
+ // Recommended
23
+ 'typescript/ban-ts-comment': [
24
+ 'error',
25
+ {
26
+ 'ts-expect-error': 'allow-with-description',
27
+ 'ts-ignore': true,
28
+ 'ts-nocheck': 'allow-with-description',
29
+ 'ts-check': false
30
+ }
31
+ ],
32
+ 'typescript/no-duplicate-enum-values': 'error',
33
+ 'typescript/no-empty-object-type': [
34
+ 'error',
35
+ {
36
+ allowInterfaces: 'with-single-extends'
37
+ }
38
+ ],
39
+ 'typescript/no-explicit-any': 'error',
40
+ 'typescript/no-extra-non-null-assertion': 'error',
41
+ 'typescript/no-misused-new': 'error',
42
+ 'typescript/no-namespace': [
43
+ 'error',
44
+ {
45
+ allowDeclarations: true,
46
+ allowDefinitionFiles: true
47
+ }
48
+ ],
49
+ 'typescript/no-non-null-asserted-optional-chain': 'error',
50
+ 'typescript/no-require-imports': 'error',
51
+ 'typescript/no-this-alias': [
52
+ 'error',
53
+ {
54
+ allowDestructuring: true,
55
+ allowedNames: ['self']
56
+ }
57
+ ],
58
+ 'typescript/no-unnecessary-type-constraint': 'error',
59
+ 'typescript/no-unsafe-declaration-merging': 'error',
60
+ 'typescript/no-unsafe-function-type': 'error',
61
+ 'typescript/no-wrapper-object-types': 'error',
62
+ 'typescript/prefer-as-const': 'error',
63
+ 'typescript/prefer-namespace-keyword': 'off',
64
+ 'typescript/triple-slash-reference': 'error',
65
+
66
+ // Rules
67
+ 'typescript/array-type': 'error',
68
+ 'typescript/await-thenable': 'off',
69
+ 'typescript/consistent-type-definitions': 'error',
70
+ 'typescript/consistent-type-exports': [
71
+ 'error',
72
+ {
73
+ fixMixedExportsWithInlineTypeSpecifier: true
74
+ }
75
+ ],
76
+ 'typescript/explicit-module-boundary-types': 'off',
77
+ 'typescript/no-dynamic-delete': 'error',
78
+ 'typescript/no-extraneous-class': 'error',
79
+ 'typescript/no-invalid-void-type': 'error',
80
+ 'typescript/prefer-for-of': 'error',
81
+ 'typescript/prefer-function-type': 'error',
82
+ 'typescript/unified-signatures': 'error',
83
+ 'trigen/member-ordering': [
84
+ 'error',
85
+ {
86
+ default: {
87
+ order: 'as-written',
88
+ memberTypes: [
89
+ 'public-static-method',
90
+ 'protected-static-method',
91
+ 'private-static-method',
92
+ 'public-static-field',
93
+ 'protected-static-field',
94
+ 'private-static-field',
95
+ 'public-decorated-field',
96
+ 'protected-decorated-field',
97
+ 'private-decorated-field',
98
+ 'public-instance-field',
99
+ 'protected-instance-field',
100
+ 'private-instance-field',
101
+ 'public-abstract-field',
102
+ 'protected-abstract-field',
103
+ 'signature',
104
+ 'public-constructor',
105
+ 'protected-constructor',
106
+ 'private-constructor',
107
+ 'instance-method'
108
+ ]
109
+ }
110
+ }
111
+ ],
112
+ 'trigen/naming-convention': [
113
+ 'error',
114
+ {
115
+ selector: 'default',
116
+ format: [
117
+ 'camelCase',
118
+ 'PascalCase',
119
+ 'UPPER_CASE'
120
+ ]
121
+ },
122
+ {
123
+ selector: 'variable',
124
+ format: [
125
+ 'camelCase',
126
+ 'UPPER_CASE',
127
+ 'PascalCase'
128
+ ]
129
+ },
130
+ {
131
+ selector: 'function',
132
+ format: ['camelCase', 'PascalCase']
133
+ },
134
+ {
135
+ selector: 'parameter',
136
+ format: ['camelCase', 'PascalCase'],
137
+ leadingUnderscore: 'allow'
138
+ },
139
+ {
140
+ selector: 'typeLike',
141
+ format: ['PascalCase']
142
+ },
143
+ {
144
+ selector: 'interface',
145
+ format: ['PascalCase']
146
+ },
147
+ {
148
+ selector: 'enumMember',
149
+ format: ['PascalCase']
150
+ },
151
+ {
152
+ selector: 'classProperty',
153
+ format: [
154
+ 'camelCase',
155
+ 'UPPER_CASE',
156
+ 'PascalCase'
157
+ ],
158
+ modifiers: ['static']
159
+ },
160
+ {
161
+ selector: ['objectLiteralProperty', 'objectLiteralMethod'],
162
+ format: null,
163
+ modifiers: ['requiresQuotes']
164
+ }
165
+ ]
166
+ }
167
+ },
168
+ {
169
+ files: dtsFiles,
170
+ rules: {
171
+ 'import/unambiguous': 'off'
172
+ }
173
+ }
174
+ ]
175
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * TypeScript stylistic config
3
+ */
4
+
5
+ import { tsFiles } from './files.js'
6
+
7
+ export default {
8
+ overrides: [
9
+ {
10
+ files: tsFiles,
11
+ jsPlugins: [
12
+ {
13
+ name: 'stylistic-js',
14
+ specifier: '@stylistic/eslint-plugin'
15
+ }
16
+ ],
17
+ rules: {
18
+ 'stylistic-js/member-delimiter-style': [
19
+ 'error',
20
+ {
21
+ multiline: {
22
+ delimiter: 'none',
23
+ requireLast: true
24
+ },
25
+ singleline: {
26
+ delimiter: 'comma',
27
+ requireLast: false
28
+ }
29
+ }
30
+ ],
31
+ 'stylistic-js/type-annotation-spacing': 'error',
32
+ 'stylistic-js/type-generic-spacing': 'error',
33
+ 'stylistic-js/type-named-tuple-spacing': 'error'
34
+ }
35
+ }
36
+ ]
37
+ }
package/src/test.js ADDED
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Test override
3
+ */
4
+
5
+ import { testFiles } from './subconfigs/files.js'
6
+
7
+ export default {
8
+ overrides: [
9
+ {
10
+ files: testFiles,
11
+ env: {
12
+ vitest: true
13
+ },
14
+ rules: {
15
+ 'eslint/max-classes-per-file': 'off',
16
+ 'eslint/no-magic-numbers': 'off',
17
+ 'eslint/max-nested-callbacks': 'off',
18
+ 'typescript/no-unsafe-return': 'off',
19
+ 'typescript/no-unsafe-assignment': 'off',
20
+ 'typescript/no-unsafe-member-access': 'off',
21
+ 'typescript/no-unsafe-call': 'off',
22
+ 'typescript/no-unsafe-argument': 'off',
23
+ 'typescript/no-explicit-any': 'off',
24
+ 'typescript/no-floating-promises': 'off',
25
+ 'trigen/import-order': 'off',
26
+ 'eslint/prefer-destructuring': 'off',
27
+ 'eslint/no-loop-func': 'off',
28
+ 'typescript/no-misused-promises': 'off'
29
+
30
+ // Unsupported by Oxlint
31
+ // 'eslint/camelcase': 'off',
32
+ }
33
+ }
34
+ ]
35
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * TypeScript type checked override
3
+ */
4
+
5
+ import typescriptTypeCheckedConfig from './subconfigs/typescript-type-checked.js'
6
+ import typescriptStylisticConfig from './subconfigs/typescript.stylistic.js'
7
+
8
+ export default {
9
+ extends: [
10
+ typescriptTypeCheckedConfig,
11
+ typescriptStylisticConfig
12
+ ]
13
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * TypeScript override
3
+ */
4
+
5
+ import typescriptConfig from './subconfigs/typescript.js'
6
+ import typescriptStylisticConfig from './subconfigs/typescript.stylistic.js'
7
+
8
+ export default {
9
+ extends: [
10
+ typescriptConfig,
11
+ typescriptStylisticConfig
12
+ ]
13
+ }