@devmoods/oxc 0.2.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.
package/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # @devmoods/oxc
2
+
3
+ Shared `oxfmt` and `oxlint` configs for Devmoods projects.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add -D @devmoods/oxc oxfmt oxlint
9
+ ```
10
+
11
+ ## Setup
12
+
13
+ Create an `oxfmt.config.ts` at the root of your project:
14
+
15
+ ```ts
16
+ import { oxfmtConfig } from '@devmoods/oxc';
17
+ import { defineConfig } from 'oxfmt';
18
+
19
+ export default defineConfig({ ...oxfmtConfig });
20
+ ```
21
+
22
+ Create an `oxlint.config.ts`:
23
+
24
+ ```ts
25
+ import { oxlintConfig } from '@devmoods/oxc';
26
+ import { defineConfig } from 'oxlint';
27
+
28
+ export default defineConfig({ ...oxlintConfig });
29
+ ```
30
+
31
+ ## CLI usage
32
+
33
+ ```bash
34
+ oxfmt .
35
+ oxlint .
36
+ ```
37
+
38
+ ## package.json scripts
39
+
40
+ ```json
41
+ {
42
+ "scripts": {
43
+ "format": "oxfmt .",
44
+ "lint": "oxlint ."
45
+ }
46
+ }
47
+ ```
48
+
49
+ For monorepos, a root script can run once across the whole repository, while package-local scripts can still exist for targeted runs.
@@ -0,0 +1,16 @@
1
+ export declare const oxfmtConfig: {
2
+ singleQuote: true;
3
+ printWidth: number;
4
+ sortPackageJson: false;
5
+ ignorePatterns: never[];
6
+ sortImports: {
7
+ customGroups: {
8
+ groupName: string;
9
+ selector: string;
10
+ elementNamePattern: string[];
11
+ }[];
12
+ newlinesBetween: true;
13
+ groups: string[];
14
+ };
15
+ };
16
+ export declare const oxlintConfig: import("oxlint").OxlintConfig;
package/dist/index.js ADDED
@@ -0,0 +1,271 @@
1
+ import { defineConfig as defineOxfmtConfig } from 'oxfmt';
2
+ import { defineConfig as defineOxlintConfig } from 'oxlint';
3
+ export const oxfmtConfig = defineOxfmtConfig({
4
+ singleQuote: true,
5
+ printWidth: 80,
6
+ sortPackageJson: false,
7
+ ignorePatterns: [],
8
+ sortImports: {
9
+ customGroups: [
10
+ {
11
+ groupName: 'scss',
12
+ selector: 'style',
13
+ elementNamePattern: ['**/*.scss'],
14
+ },
15
+ ],
16
+ newlinesBetween: true,
17
+ groups: [
18
+ 'scss',
19
+ 'style',
20
+ 'type-import',
21
+ 'type-builtin',
22
+ 'value-builtin',
23
+ 'type-external',
24
+ 'value-external',
25
+ 'type-internal',
26
+ 'value-internal',
27
+ 'type-index',
28
+ 'type-sibling',
29
+ 'type-parent',
30
+ 'value-index',
31
+ 'value-sibling',
32
+ 'value-parent',
33
+ 'unknown',
34
+ ],
35
+ },
36
+ });
37
+ export const oxlintConfig = defineOxlintConfig({
38
+ plugins: ['typescript', 'jsx-a11y', 'react'],
39
+ categories: {
40
+ correctness: 'off',
41
+ },
42
+ env: {
43
+ builtin: true,
44
+ },
45
+ rules: {
46
+ 'constructor-super': 'error',
47
+ 'for-direction': 'error',
48
+ 'no-async-promise-executor': 'error',
49
+ 'no-case-declarations': 'error',
50
+ 'no-class-assign': 'error',
51
+ 'no-compare-neg-zero': 'error',
52
+ 'no-cond-assign': 'error',
53
+ 'no-const-assign': 'error',
54
+ 'no-constant-binary-expression': 'error',
55
+ 'no-constant-condition': 'error',
56
+ 'no-control-regex': 'error',
57
+ 'no-debugger': 'error',
58
+ 'no-delete-var': 'error',
59
+ 'no-dupe-class-members': 'error',
60
+ 'no-dupe-else-if': 'error',
61
+ 'no-dupe-keys': 'error',
62
+ 'no-duplicate-case': 'error',
63
+ 'no-empty': 'error',
64
+ 'no-empty-character-class': 'error',
65
+ 'no-empty-pattern': 'off',
66
+ 'no-empty-static-block': 'error',
67
+ 'no-ex-assign': 'error',
68
+ 'no-extra-boolean-cast': 'error',
69
+ 'no-fallthrough': 'error',
70
+ 'no-func-assign': 'error',
71
+ 'no-global-assign': 'error',
72
+ 'no-import-assign': 'error',
73
+ 'no-invalid-regexp': 'error',
74
+ 'no-irregular-whitespace': 'error',
75
+ 'no-loss-of-precision': 'error',
76
+ 'no-misleading-character-class': 'error',
77
+ 'no-new-native-nonconstructor': 'error',
78
+ 'no-nonoctal-decimal-escape': 'error',
79
+ 'no-obj-calls': 'error',
80
+ 'no-prototype-builtins': 'error',
81
+ 'no-redeclare': 'error',
82
+ 'no-regex-spaces': 'error',
83
+ 'no-self-assign': 'error',
84
+ 'no-setter-return': 'error',
85
+ 'no-shadow-restricted-names': 'error',
86
+ 'no-sparse-arrays': 'error',
87
+ 'no-this-before-super': 'error',
88
+ 'no-unexpected-multiline': 'error',
89
+ 'no-unsafe-finally': 'error',
90
+ 'no-unsafe-negation': 'error',
91
+ 'no-unsafe-optional-chaining': 'error',
92
+ 'no-unused-labels': 'error',
93
+ 'no-unused-private-class-members': 'error',
94
+ 'no-unused-vars': ['error', { varsIgnorePattern: 'Assertions' }],
95
+ 'no-useless-backreference': 'error',
96
+ 'no-useless-catch': 'error',
97
+ 'no-useless-escape': 'error',
98
+ 'no-with': 'error',
99
+ 'require-yield': 'error',
100
+ 'use-isnan': 'error',
101
+ 'valid-typeof': 'error',
102
+ '@typescript-eslint/ban-ts-comment': 'error',
103
+ 'no-array-constructor': 'error',
104
+ '@typescript-eslint/no-duplicate-enum-values': 'error',
105
+ '@typescript-eslint/no-empty-object-type': 'error',
106
+ '@typescript-eslint/no-explicit-any': 'error',
107
+ '@typescript-eslint/no-extra-non-null-assertion': 'error',
108
+ '@typescript-eslint/no-misused-new': 'error',
109
+ '@typescript-eslint/no-namespace': 'error',
110
+ '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
111
+ '@typescript-eslint/no-require-imports': 'error',
112
+ '@typescript-eslint/no-this-alias': 'error',
113
+ '@typescript-eslint/no-unnecessary-type-constraint': 'error',
114
+ '@typescript-eslint/no-unsafe-declaration-merging': 'error',
115
+ '@typescript-eslint/no-unsafe-function-type': 'error',
116
+ 'no-unused-expressions': 'error',
117
+ '@typescript-eslint/no-wrapper-object-types': 'error',
118
+ '@typescript-eslint/prefer-as-const': 'error',
119
+ '@typescript-eslint/prefer-namespace-keyword': 'error',
120
+ '@typescript-eslint/triple-slash-reference': 'error',
121
+ 'jsx-a11y/alt-text': 'error',
122
+ 'jsx-a11y/anchor-has-content': 'error',
123
+ 'jsx-a11y/anchor-is-valid': 'error',
124
+ 'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
125
+ 'jsx-a11y/aria-props': 'error',
126
+ 'jsx-a11y/aria-proptypes': 'error',
127
+ 'jsx-a11y/aria-role': 'error',
128
+ 'jsx-a11y/aria-unsupported-elements': 'error',
129
+ 'jsx-a11y/autocomplete-valid': 'error',
130
+ 'jsx-a11y/click-events-have-key-events': 'error',
131
+ 'jsx-a11y/heading-has-content': 'error',
132
+ 'jsx-a11y/html-has-lang': 'error',
133
+ 'jsx-a11y/iframe-has-title': 'error',
134
+ 'jsx-a11y/img-redundant-alt': 'error',
135
+ 'jsx-a11y/label-has-associated-control': 'error',
136
+ 'jsx-a11y/media-has-caption': 'error',
137
+ 'jsx-a11y/mouse-events-have-key-events': 'error',
138
+ 'jsx-a11y/no-access-key': 'error',
139
+ 'jsx-a11y/no-distracting-elements': 'error',
140
+ 'jsx-a11y/no-noninteractive-tabindex': [
141
+ 'error',
142
+ { tags: [], roles: ['tabpanel'], allowExpressionValues: true },
143
+ ],
144
+ 'jsx-a11y/no-redundant-roles': 'error',
145
+ 'jsx-a11y/no-static-element-interactions': [
146
+ 'error',
147
+ {
148
+ allowExpressionValues: true,
149
+ handlers: [
150
+ 'onClick',
151
+ 'onMouseDown',
152
+ 'onMouseUp',
153
+ 'onKeyPress',
154
+ 'onKeyDown',
155
+ 'onKeyUp',
156
+ ],
157
+ },
158
+ ],
159
+ 'jsx-a11y/role-has-required-aria-props': 'error',
160
+ 'jsx-a11y/role-supports-aria-props': 'error',
161
+ 'jsx-a11y/scope': 'error',
162
+ 'jsx-a11y/tabindex-no-positive': 'error',
163
+ 'react/display-name': 'error',
164
+ 'react/jsx-curly-brace-presence': 'error',
165
+ 'react/jsx-boolean-value': 'error',
166
+ 'react/self-closing-comp': 'error',
167
+ 'react-hooks/exhaustive-deps': 'error',
168
+ 'react-hooks/rules-of-hooks': 'error',
169
+ 'no-restricted-imports': [
170
+ 'error',
171
+ {
172
+ patterns: [
173
+ {
174
+ group: ['react'],
175
+ importNames: ['default'],
176
+ message: "Do not import 'React'",
177
+ },
178
+ {
179
+ group: ['react'],
180
+ importNames: ['FunctionComponent', 'FC', 'PropsWithChildren'],
181
+ message: 'Annotate the props',
182
+ },
183
+ ],
184
+ },
185
+ ],
186
+ },
187
+ ignorePatterns: [
188
+ '**/playwright-report/**',
189
+ '**/build/**',
190
+ '**/coverage/**',
191
+ '**/dist/**',
192
+ '**/snap/**',
193
+ '**/vite.config.*.timestamp-*.*',
194
+ ],
195
+ overrides: [
196
+ {
197
+ files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
198
+ rules: {
199
+ 'constructor-super': 'off',
200
+ 'no-class-assign': 'off',
201
+ 'no-const-assign': 'off',
202
+ 'no-dupe-class-members': 'off',
203
+ 'no-dupe-keys': 'off',
204
+ 'no-func-assign': 'off',
205
+ 'no-import-assign': 'off',
206
+ 'no-new-native-nonconstructor': 'off',
207
+ 'no-obj-calls': 'off',
208
+ 'no-redeclare': 'off',
209
+ 'no-setter-return': 'off',
210
+ 'no-this-before-super': 'off',
211
+ 'no-unsafe-negation': 'off',
212
+ 'no-var': 'error',
213
+ 'no-with': 'off',
214
+ 'prefer-const': 'error',
215
+ 'prefer-rest-params': 'error',
216
+ 'prefer-spread': 'error',
217
+ },
218
+ },
219
+ {
220
+ files: ['**/*.{js,jsx,mjs,ts,tsx,mts}'],
221
+ rules: {
222
+ '@typescript-eslint/consistent-type-definitions': 'error',
223
+ '@typescript-eslint/consistent-type-imports': [
224
+ 'error',
225
+ { fixStyle: 'inline-type-imports' },
226
+ ],
227
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
228
+ '@typescript-eslint/no-empty-interface': 'off',
229
+ '@typescript-eslint/no-empty-object-type': 'off',
230
+ '@typescript-eslint/no-explicit-any': 'off',
231
+ '@typescript-eslint/no-inferrable-types': 'off',
232
+ '@typescript-eslint/no-non-null-assertion': 'off',
233
+ eqeqeq: ['error', 'always', { null: 'ignore' }],
234
+ 'import/no-default-export': 'error',
235
+ 'import/no-mutable-exports': 'error',
236
+ 'import/consistent-type-specifier-style': ['error', 'prefer-inline'],
237
+ 'import/no-duplicates': ['error', { 'prefer-inline': true }],
238
+ 'import/no-named-as-default-member': 'off',
239
+ curly: 'error',
240
+ 'no-console': 'error',
241
+ 'no-dupe-keys': 'error',
242
+ 'no-empty': ['error', { allowEmptyCatch: true }],
243
+ 'no-var': 'error',
244
+ 'prefer-template': 'error',
245
+ 'no-unused-vars': ['error', { ignoreRestSiblings: true }],
246
+ 'no-empty-function': 'off',
247
+ 'no-shadow': 'error',
248
+ },
249
+ env: {
250
+ es2022: true,
251
+ browser: true,
252
+ node: true,
253
+ },
254
+ plugins: ['import'],
255
+ },
256
+ {
257
+ files: ['**/*.config.{js,ts,mjs,mts}', '**/*.stories.{js,jsx,ts,tsx}'],
258
+ rules: {
259
+ 'import/no-default-export': 'off',
260
+ },
261
+ plugins: ['import'],
262
+ },
263
+ {
264
+ files: ['**/*.gen*'],
265
+ rules: {
266
+ '@typescript-eslint/ban-ts-comment': 'off',
267
+ 'no-shadow': 'off',
268
+ },
269
+ },
270
+ ],
271
+ });
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@devmoods/oxc",
3
+ "version": "0.2.0",
4
+ "description": "Shared oxfmt and oxlint configs for Devmoods projects",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "./package.json": "./package.json"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md"
20
+ ],
21
+ "scripts": {
22
+ "clean": "rm -rf dist",
23
+ "lint": "oxlint .",
24
+ "format": "oxfmt .",
25
+ "build": "pnpm run clean && tsgo",
26
+ "prepublishOnly": "pnpm run clean && pnpm run build"
27
+ },
28
+ "peerDependencies": {
29
+ "oxfmt": "^0.44.0",
30
+ "oxlint": "^1.59.0"
31
+ },
32
+ "license": "MIT",
33
+ "gitHead": "2c4100d80823bcf16bd962b4b8a26bd078522dfc"
34
+ }