@robot-inventor/oxlint-config 0.0.0 → 0.1.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/index.js ADDED
@@ -0,0 +1,264 @@
1
+ import { defineConfig } from "oxlint";
2
+ import { NEXTJS_RULES, RECOMMENDED_RULES } from "oxlint-plugin-react-doctor";
3
+ import { baseRules, typescriptOverrides } from "./base-rules.js";
4
+ const corePluginSpecifier = new URL(import.meta.url.endsWith(".ts") ? "./eslint-core-plugin.ts" : "./eslint-core-plugin.js", import.meta.url).href;
5
+ const baseJsPlugins = [
6
+ {
7
+ name: "eslint-core-js",
8
+ specifier: corePluginSpecifier
9
+ },
10
+ {
11
+ name: "import-js",
12
+ specifier: import.meta.resolve("eslint-plugin-import-x")
13
+ },
14
+ {
15
+ name: "jsdoc-js",
16
+ specifier: import.meta.resolve("eslint-plugin-jsdoc")
17
+ }
18
+ ];
19
+ const reactJsPlugins = [
20
+ ...baseJsPlugins,
21
+ {
22
+ name: "react-doctor",
23
+ specifier: import.meta.resolve("oxlint-plugin-react-doctor")
24
+ }
25
+ ];
26
+ const nextJsPlugins = [
27
+ ...reactJsPlugins,
28
+ {
29
+ name: "nextjs-js",
30
+ specifier: import.meta.resolve("@next/eslint-plugin-next")
31
+ }
32
+ ];
33
+ const commonSettings = {
34
+ "import-x/extensions": [".ts", ".tsx", ".cts", ".mts", ".js", ".jsx", ".cjs", ".mjs"],
35
+ "import-x/external-module-folders": ["node_modules", "node_modules/@types"],
36
+ "import-x/parsers": {
37
+ "@typescript-eslint/parser": [".ts", ".tsx", ".cts", ".mts"]
38
+ },
39
+ "import-x/resolver": {
40
+ node: true,
41
+ typescript: true
42
+ }
43
+ };
44
+ const reactSettings = {
45
+ ...commonSettings,
46
+ "react-doctor": {
47
+ capabilities: ["react-compiler"]
48
+ }
49
+ };
50
+ const commonRoot = {
51
+ categories: {
52
+ correctness: "off"
53
+ },
54
+ env: {
55
+ builtin: true
56
+ },
57
+ options: {
58
+ reportUnusedDisableDirectives: "error",
59
+ typeAware: true
60
+ }
61
+ };
62
+ const baseConfig = defineConfig({
63
+ plugins: ["typescript", "jsdoc", "unicorn", "import"],
64
+ rules: {
65
+ ...baseRules,
66
+ "eslint-core-js/camelcase": "error",
67
+ "eslint-core-js/require-atomic-updates": "error",
68
+ "import-js/no-extraneous-dependencies": "error",
69
+ "import-js/no-unresolved": "error",
70
+ "import-js/no-useless-path-segments": "error",
71
+ "jsdoc-js/check-alignment": "error",
72
+ "jsdoc-js/check-param-names": "error",
73
+ "jsdoc-js/check-types": "error",
74
+ "jsdoc-js/check-values": "error",
75
+ "jsdoc-js/escape-inline-tags": "error",
76
+ "jsdoc-js/multiline-blocks": "error",
77
+ "jsdoc-js/no-multi-asterisks": "error",
78
+ "jsdoc-js/no-types": "error",
79
+ "jsdoc-js/reject-any-type": "error",
80
+ "jsdoc-js/reject-function-type": "error",
81
+ "jsdoc-js/require-next-type": "error",
82
+ "jsdoc-js/require-returns-check": "error",
83
+ "jsdoc-js/require-yields-check": "error",
84
+ "jsdoc-js/tag-lines": "error",
85
+ "jsdoc-js/ts-no-empty-object-type": "error",
86
+ "jsdoc-js/valid-types": "error"
87
+ },
88
+ overrides: [
89
+ {
90
+ files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
91
+ rules: typescriptOverrides
92
+ }
93
+ ]
94
+ });
95
+ const noJSDocRequirement = defineConfig({
96
+ rules: {
97
+ "jsdoc-js/require-jsdoc": "off"
98
+ }
99
+ });
100
+ const JSDocRequirement = defineConfig({
101
+ rules: {
102
+ "jsdoc-js/require-jsdoc": [
103
+ "error",
104
+ {
105
+ checkAllFunctionExpressions: false,
106
+ checkConstructors: true,
107
+ checkGetters: true,
108
+ checkSetters: true,
109
+ enableFixer: true,
110
+ exemptEmptyConstructors: false,
111
+ exemptEmptyFunctions: false,
112
+ exemptOverloadedImplementations: false,
113
+ fixerMessage: "",
114
+ require: {
115
+ ArrowFunctionExpression: true,
116
+ ClassDeclaration: true,
117
+ ClassExpression: true,
118
+ FunctionDeclaration: true,
119
+ FunctionExpression: true,
120
+ MethodDefinition: true
121
+ },
122
+ skipInterveningOverloadedDeclarations: true
123
+ }
124
+ ]
125
+ }
126
+ });
127
+ const reactConfig = defineConfig({
128
+ plugins: ["react"],
129
+ rules: {
130
+ ...RECOMMENDED_RULES,
131
+ "react/exhaustive-deps": "warn",
132
+ "react/rules-of-hooks": "error"
133
+ },
134
+ overrides: [
135
+ {
136
+ files: ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"],
137
+ rules: {
138
+ "jsdoc/check-tag-names": [
139
+ "error",
140
+ {
141
+ definedTags: ["jsxImportSource"]
142
+ }
143
+ ],
144
+ "react/capitalized-calls": "error",
145
+ "react/error-boundaries": "error",
146
+ "react/exhaustive-effect-dependencies": "off",
147
+ "react/globals": "error",
148
+ "react/hooks": "off",
149
+ "react/immutability": "error",
150
+ "react/incompatible-library": "error",
151
+ "react/invariant": "warn",
152
+ "react/hook-use-state": "warn",
153
+ "react/iframe-missing-sandbox": "warn",
154
+ "react/jsx-boolean-value": ["error", "never"],
155
+ "react/jsx-curly-brace-presence": ["error", "never"],
156
+ "react/jsx-key": "error",
157
+ "react/jsx-no-comment-textnodes": "warn",
158
+ "react/jsx-no-script-url": "warn",
159
+ "react/memo-dependencies": "off",
160
+ "react/no-array-index-key": "warn",
161
+ "react/no-children-prop": "warn",
162
+ "react/no-clone-element": "warn",
163
+ "react/no-danger": "warn",
164
+ "react/no-danger-with-children": "error",
165
+ "react/no-deriving-state-in-effects": "error",
166
+ "react/no-did-mount-set-state": "warn",
167
+ "react/no-did-update-set-state": "warn",
168
+ "react/no-direct-mutation-state": "error",
169
+ "react/no-find-dom-node": "error",
170
+ "react/no-namespace": "error",
171
+ "react/no-react-children": "warn",
172
+ "react/no-render-return-value": "error",
173
+ "react/no-unsafe": ["error", { checkAliases: true }],
174
+ "react/no-unstable-nested-components": "error",
175
+ "react/no-will-update-set-state": "warn",
176
+ "react/preserve-manual-memoization": "error",
177
+ "react/purity": "error",
178
+ "react/refs": "error",
179
+ "react/rule-suppression": "error",
180
+ "react/self-closing-comp": [
181
+ "error",
182
+ {
183
+ component: true,
184
+ html: true
185
+ }
186
+ ],
187
+ "react/set-state-in-effect": "error",
188
+ "react/set-state-in-render": "error",
189
+ "react/static-components": "error",
190
+ "react/syntax": "error",
191
+ "react/todo": "warn",
192
+ "react/unsupported-syntax": "error",
193
+ "react/use-memo": "error",
194
+ "react/void-dom-elements-no-children": "error",
195
+ "react/void-use-memo": "error"
196
+ }
197
+ }
198
+ ]
199
+ });
200
+ const nextConfig = defineConfig({
201
+ plugins: ["nextjs"],
202
+ rules: {
203
+ ...NEXTJS_RULES,
204
+ "nextjs-js/no-location-assign-relative-destination": "warn",
205
+ "nextjs/google-font-display": "warn",
206
+ "nextjs/google-font-preconnect": "warn",
207
+ "nextjs/inline-script-id": "error",
208
+ "nextjs/next-script-for-ga": "warn",
209
+ "nextjs/no-assign-module-variable": "error",
210
+ "nextjs/no-async-client-component": "warn",
211
+ "nextjs/no-before-interactive-script-outside-document": "warn",
212
+ "nextjs/no-css-tags": "warn",
213
+ "nextjs/no-document-import-in-page": "error",
214
+ "nextjs/no-duplicate-head": "error",
215
+ "nextjs/no-head-element": "warn",
216
+ "nextjs/no-head-import-in-document": "error",
217
+ "nextjs/no-html-link-for-pages": "error",
218
+ "nextjs/no-img-element": "warn",
219
+ "nextjs/no-page-custom-font": "warn",
220
+ "nextjs/no-script-component-in-head": "error",
221
+ "nextjs/no-styled-jsx-in-document": "warn",
222
+ "nextjs/no-sync-scripts": "error",
223
+ "nextjs/no-title-in-document-head": "warn",
224
+ "nextjs/no-typos": "warn",
225
+ "nextjs/no-unwanted-polyfillio": "warn"
226
+ }
227
+ });
228
+ const oxlintConfigNoJSDoc = defineConfig({
229
+ ...commonRoot,
230
+ extends: [baseConfig, noJSDocRequirement],
231
+ jsPlugins: baseJsPlugins,
232
+ settings: commonSettings
233
+ });
234
+ const oxlintConfig = defineConfig({
235
+ ...commonRoot,
236
+ extends: [baseConfig, JSDocRequirement],
237
+ jsPlugins: baseJsPlugins,
238
+ settings: commonSettings
239
+ });
240
+ const oxlintReactConfigNoJSDoc = defineConfig({
241
+ ...commonRoot,
242
+ extends: [baseConfig, noJSDocRequirement, reactConfig],
243
+ jsPlugins: reactJsPlugins,
244
+ settings: reactSettings
245
+ });
246
+ const oxlintReactConfig = defineConfig({
247
+ ...commonRoot,
248
+ extends: [baseConfig, JSDocRequirement, reactConfig],
249
+ jsPlugins: reactJsPlugins,
250
+ settings: reactSettings
251
+ });
252
+ const oxlintNextConfigNoJSDoc = defineConfig({
253
+ ...commonRoot,
254
+ extends: [baseConfig, noJSDocRequirement, reactConfig, nextConfig],
255
+ jsPlugins: nextJsPlugins,
256
+ settings: reactSettings
257
+ });
258
+ const oxlintNextConfig = defineConfig({
259
+ ...commonRoot,
260
+ extends: [baseConfig, JSDocRequirement, reactConfig, nextConfig],
261
+ jsPlugins: nextJsPlugins,
262
+ settings: reactSettings
263
+ });
264
+ export { oxlintConfig, oxlintConfigNoJSDoc, oxlintNextConfig, oxlintNextConfigNoJSDoc, oxlintReactConfig, oxlintReactConfigNoJSDoc };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robot-inventor/oxlint-config",
3
- "version": "0.0.0",
3
+ "version": "0.1.1",
4
4
  "description": "My Oxlint config preset",
5
5
  "homepage": "https://github.com/Robot-Inventor/oxlint-config#readme",
6
6
  "bugs": {
@@ -14,25 +14,43 @@
14
14
  "author": "Robot-Inventor",
15
15
  "type": "module",
16
16
  "main": "dist/index.js",
17
+ "types": "dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js",
22
+ "default": "./dist/index.js"
23
+ }
24
+ },
17
25
  "files": ["dist"],
18
26
  "publishConfig": {
19
- "access": "public"
27
+ "access": "public",
28
+ "provenance": true
20
29
  },
21
30
  "scripts": {
22
31
  "build": "tsc",
23
- "lint": "oxlint \"./src/**/*.ts\"",
24
- "format": "prettier --write ./**/*.ts",
25
- "format:check": "prettier --check ./**/*.ts",
32
+ "lint": "oxlint src oxlint.config.ts",
33
+ "format": "prettier --write \"src/**/*.ts\" oxlint.config.ts",
34
+ "format:check": "prettier --check \"src/**/*.ts\" oxlint.config.ts",
26
35
  "ci:version": "changeset version",
27
36
  "ci:publish": "npm run build && changeset publish"
28
37
  },
29
38
  "devDependencies": {
39
+ "@changesets/changelog-github": "^1.0.1",
30
40
  "@changesets/cli": "^3.0.2",
31
41
  "@robot-inventor/tsconfig-base": "^7.2.0",
32
42
  "prettier": "^3.9.6",
33
43
  "typescript": "^7.0.2"
34
44
  },
35
45
  "dependencies": {
36
- "oxlint": "^1.82.0"
46
+ "@next/eslint-plugin-next": "^16.3.4",
47
+ "eslint": "^10.10.0",
48
+ "eslint-import-resolver-node": "^0.4.0",
49
+ "eslint-import-resolver-typescript": "^4.4.5",
50
+ "eslint-plugin-import-x": "^4.17.1",
51
+ "eslint-plugin-jsdoc": "^64.3.9",
52
+ "oxlint": "^1.82.0",
53
+ "oxlint-plugin-react-doctor": "^0.9.13",
54
+ "oxlint-tsgolint": "^7.0.2001"
37
55
  }
38
56
  }