@apify/oxlint-config 0.2.2 → 0.2.4
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 +1 -1
- package/index.js +15 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ npx oxlint --type-aware
|
|
|
55
55
|
|
|
56
56
|
The shared config provides:
|
|
57
57
|
|
|
58
|
-
- **Plugins** — `typescript`, `import`, `unicorn`, `jest`, `promise` (Rust-side, no install required). React plugins are intentionally **not** included; consumers add `'react'` to `plugins` if their project uses React. (Note: oxlint's `react` plugin already covers React Hooks rules; there's no separate `react-hooks` plugin.)
|
|
58
|
+
- **Plugins** — `typescript`, `import`, `unicorn`, `jest`, `vitest`, `promise` (Rust-side, no install required). Both `jest` and `vitest` are enabled because vitest's API is jest-compatible — most of the test best-practices we care about live in the `jest/*` rules and apply equally to vitest tests. The `vitest` plugin adds a few framework-specific rules (e.g. `vitest/hoisted-apis-on-top`, `vitest/no-conditional-tests`) on top. React plugins are intentionally **not** included; consumers add `'react'` to `plugins` if their project uses React. (Note: oxlint's `react` plugin already covers React Hooks rules; there's no separate `react-hooks` plugin.)
|
|
59
59
|
- **Rules** — the Apify house rules: `typescript/consistent-type-imports`, `typescript/no-floating-promises`, `unicorn/prefer-node-protocol`, `import/no-default-export`, `unicorn/no-await-in-promise-methods`, plus the curated `off` list of TypeScript strict rules we don't want.
|
|
60
60
|
- **Overrides** — relaxed rules for test files, vite/jest/vitest config files, story files, and integration test directories.
|
|
61
61
|
|
package/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import { defineConfig as oxlintDefineConfig } from 'oxlint';
|
|
|
18
18
|
* manually.
|
|
19
19
|
*/
|
|
20
20
|
const sharedConfig = {
|
|
21
|
-
plugins: ['typescript', 'import', 'unicorn', 'jest', 'promise'],
|
|
21
|
+
plugins: ['typescript', 'import', 'unicorn', 'jest', 'vitest', 'promise'],
|
|
22
22
|
env: {
|
|
23
23
|
node: true,
|
|
24
24
|
browser: true,
|
|
@@ -44,20 +44,6 @@ const sharedConfig = {
|
|
|
44
44
|
],
|
|
45
45
|
'no-labels': 'error',
|
|
46
46
|
'guard-for-in': 'error',
|
|
47
|
-
'import-js/no-extraneous-dependencies': [
|
|
48
|
-
'error',
|
|
49
|
-
{
|
|
50
|
-
devDependencies: [
|
|
51
|
-
'**/vite.config.{js,ts,mjs,mts}',
|
|
52
|
-
'**/vitest.config.{js,ts,mjs,mts}',
|
|
53
|
-
'**/*.test.{js,ts,jsx,tsx}',
|
|
54
|
-
'**/*.spec.{js,ts,jsx,tsx}',
|
|
55
|
-
'**/{test,tests,integration_tests}/**/*.{js,ts,jsx,tsx,mjs,mts,cjs,cts}',
|
|
56
|
-
'**/.storybook/**/*.{js,ts,jsx,tsx}',
|
|
57
|
-
'**/*.stories.{js,jsx,ts,tsx}',
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
47
|
'typescript/no-shadow': 'error',
|
|
62
48
|
'no-shadow': 'off',
|
|
63
49
|
'typescript/no-non-null-assertion': 'off',
|
|
@@ -97,6 +83,20 @@ const sharedConfig = {
|
|
|
97
83
|
'unicorn/no-await-in-promise-methods': 'error',
|
|
98
84
|
'jest/require-to-throw-message': 'off',
|
|
99
85
|
'jest/prefer-snapshot-hint': 'off',
|
|
86
|
+
// Vitest plugin auto-enables most of its rules at error level. Keep
|
|
87
|
+
// the few that catch real bugs and turn the noisy/opinionated/buggy
|
|
88
|
+
// ones off:
|
|
89
|
+
// - hoisted-apis-on-top: false-positive on `vi.mocked()`, which is
|
|
90
|
+
// a TypeScript type-helper (not a hoisted API).
|
|
91
|
+
// - require-mock-type-parameters: too aggressive (every .mock() call
|
|
92
|
+
// would need a type parameter); opt-in per project if desired.
|
|
93
|
+
// - consistent-each-for, warn-todo, require-local-test-context-for-
|
|
94
|
+
// concurrent-snapshots: opinion / niche.
|
|
95
|
+
'vitest/hoisted-apis-on-top': 'off',
|
|
96
|
+
'vitest/require-mock-type-parameters': 'off',
|
|
97
|
+
'vitest/consistent-each-for': 'off',
|
|
98
|
+
'vitest/warn-todo': 'off',
|
|
99
|
+
'vitest/require-local-test-context-for-concurrent-snapshots': 'off',
|
|
100
100
|
'typescript/unbound-method': 'off',
|
|
101
101
|
'typescript/restrict-template-expressions': 'off',
|
|
102
102
|
'typescript/no-useless-default-assignment': 'off',
|
|
@@ -143,7 +143,6 @@ const sharedConfig = {
|
|
|
143
143
|
'typescript/await-thenable': 'off',
|
|
144
144
|
'typescript/no-floating-promises': 'off',
|
|
145
145
|
'typescript/no-misused-promises': 'off',
|
|
146
|
-
'import-js/no-extraneous-dependencies': 'off',
|
|
147
146
|
'jest/no-disabled-tests': 'error',
|
|
148
147
|
'jest/no-conditional-expect': 'error',
|
|
149
148
|
'jest/no-focused-tests': 'error',
|