@wistia/oxlint-config 1.7.2 → 1.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wistia/oxlint-config",
3
- "version": "1.7.2",
3
+ "version": "1.8.0",
4
4
  "description": "Wistia's Oxlint configurations",
5
5
  "packageManager": "yarn@4.17.1",
6
6
  "type": "module",
@@ -11,7 +11,8 @@
11
11
  "/index.mjs",
12
12
  "/index.d.mts",
13
13
  "/oxfmtConfig.mjs",
14
- "/oxfmtConfig.d.mts"
14
+ "/oxfmtConfig.d.mts",
15
+ "/resolve-plugin.mjs"
15
16
  ],
16
17
  "exports": {
17
18
  "./package.json": "./package.json",
@@ -60,9 +61,9 @@
60
61
  },
61
62
  "peerDependencies": {
62
63
  "eslint": ">= 10.6.0",
63
- "oxfmt": ">= 0.57.0",
64
- "oxlint": ">= 1.72.0",
65
- "oxlint-tsgolint": ">= 0.23.0"
64
+ "oxfmt": ">= 0.58.0",
65
+ "oxlint": ">= 1.73.0",
66
+ "oxlint-tsgolint": ">= 0.24.0"
66
67
  },
67
68
  "peerDependenciesMeta": {
68
69
  "oxfmt": {
@@ -89,9 +90,9 @@
89
90
  "@changesets/changelog-github": "^0.7.0",
90
91
  "@changesets/cli": "^2.31.0",
91
92
  "eslint": "^10.6.0",
92
- "oxfmt": "^0.57.0",
93
- "oxlint": "^1.72.0",
94
- "oxlint-tsgolint": "^0.23.0",
93
+ "oxfmt": "^0.58.0",
94
+ "oxlint": "^1.73.0",
95
+ "oxlint-tsgolint": "^0.24.0",
95
96
  "storybook": "^10.4.6",
96
97
  "vitest": "^4.1.9"
97
98
  },
@@ -0,0 +1,10 @@
1
+ import { fileURLToPath } from 'node:url';
2
+
3
+ // Resolves a jsPlugin package to an absolute path from within this package.
4
+ // oxlint resolves bare specifiers (e.g. 'eslint-plugin-storybook') from the
5
+ // consumer's config location, not from this package — so when a consumer's
6
+ // dependency tree nests this package's dependencies (e.g. its typescript
7
+ // version differs from the consumer's root), bare specifiers fail to resolve.
8
+ // An absolute path loads the copy this package depends on, both in this repo
9
+ // and from a consumer's node_modules.
10
+ export const resolvePlugin = (specifier) => fileURLToPath(import.meta.resolve(specifier));
@@ -1,7 +1,9 @@
1
+ import { resolvePlugin } from '../resolve-plugin.mjs';
2
+
1
3
  // All barrel-files rules loaded via jsPlugins (no native oxlint support).
2
4
  // see: https://marvinh.dev/blog/speeding-up-javascript-ecosystem-part-7/
3
5
  export const barrelFilesRules = {
4
- jsPlugins: ['eslint-plugin-barrel-files'],
6
+ jsPlugins: [resolvePlugin('eslint-plugin-barrel-files')],
5
7
  rules: {
6
8
  // Avoid barrel files
7
9
  // https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/docs/rules/avoid-barrel-files.md
package/rules/base.mjs CHANGED
@@ -175,6 +175,10 @@ export const baseRules = {
175
175
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unreachable.html
176
176
  'eslint/no-unreachable': 'error',
177
177
 
178
+ // Disallow loops whose body allows only one iteration
179
+ // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unreachable-loop.html
180
+ 'eslint/no-unreachable-loop': 'error',
181
+
178
182
  // Disallow control flow statements in finally blocks
179
183
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unsafe-finally.html
180
184
  'eslint/no-unsafe-finally': 'error',
package/rules/import.mjs CHANGED
@@ -1,8 +1,10 @@
1
+ import { resolvePlugin } from '../resolve-plugin.mjs';
2
+
1
3
  // Native oxlint import rules + eslint-plugin-import-x via jsPlugins for rules
2
4
  // without native equivalents.
3
5
  export const importRules = {
4
6
  plugins: ['import'],
5
- jsPlugins: [{ name: 'import-x-js', specifier: 'eslint-plugin-import-x' }],
7
+ jsPlugins: [{ name: 'import-x-js', specifier: resolvePlugin('eslint-plugin-import-x') }],
6
8
  rules: {
7
9
  // Ensure named imports coupled with named exports
8
10
  // https://oxc.rs/docs/guide/usage/linter/rules/import/named.html
package/rules/node.mjs CHANGED
@@ -1,8 +1,10 @@
1
+ import { resolvePlugin } from '../resolve-plugin.mjs';
2
+
1
3
  // Native oxlint node rules + eslint-plugin-n via jsPlugins for rules
2
4
  // without native equivalents.
3
5
  export const nodeRules = {
4
6
  plugins: ['node'],
5
- jsPlugins: [{ name: 'n', specifier: 'eslint-plugin-n' }],
7
+ jsPlugins: [{ name: 'n', specifier: resolvePlugin('eslint-plugin-n') }],
6
8
  rules: {
7
9
  // Require return statements after callbacks
8
10
  // https://oxc.rs/docs/guide/usage/linter/rules/node/callback-return.html
@@ -1,6 +1,8 @@
1
+ import { resolvePlugin } from '../resolve-plugin.mjs';
2
+
1
3
  // All playwright rules loaded via jsPlugins (no native oxlint support).
2
4
  export const playwrightRules = {
3
- jsPlugins: ['eslint-plugin-playwright'],
5
+ jsPlugins: [resolvePlugin('eslint-plugin-playwright')],
4
6
  rules: {
5
7
  // Disallow focused tests
6
8
  // https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/no-focused-test.md
package/rules/react.mjs CHANGED
@@ -1,8 +1,10 @@
1
+ import { resolvePlugin } from '../resolve-plugin.mjs';
2
+
1
3
  // Native oxlint react rules + @eslint-react/eslint-plugin via jsPlugins for rules
2
4
  // without native equivalents.
3
5
  export const reactRules = {
4
6
  plugins: ['react'],
5
- jsPlugins: [{ name: '@eslint-react', specifier: '@eslint-react/eslint-plugin' }],
7
+ jsPlugins: [{ name: '@eslint-react', specifier: resolvePlugin('@eslint-react/eslint-plugin') }],
6
8
  rules: {
7
9
  // Enforce that button elements have an explicit type attribute
8
10
  // https://oxc.rs/docs/guide/usage/linter/rules/react/button-has-type.html
@@ -1,6 +1,8 @@
1
+ import { resolvePlugin } from '../resolve-plugin.mjs';
2
+
1
3
  // All storybook rules loaded via jsPlugins (no native oxlint support).
2
4
  export const storybookRules = {
3
- jsPlugins: ['eslint-plugin-storybook'],
5
+ jsPlugins: [resolvePlugin('eslint-plugin-storybook')],
4
6
  rules: {
5
7
  // Interactions should be awaited
6
8
  // https://github.com/storybookjs/eslint-plugin-storybook/blob/main/docs/rules/await-interactions.md
@@ -1,6 +1,8 @@
1
+ import { resolvePlugin } from '../resolve-plugin.mjs';
2
+
1
3
  // All styled-components-a11y rules loaded via jsPlugins (no native oxlint support).
2
4
  export const styledComponentsRules = {
3
- jsPlugins: ['eslint-plugin-styled-components-a11y'],
5
+ jsPlugins: [resolvePlugin('eslint-plugin-styled-components-a11y')],
4
6
  rules: {
5
7
  // Enforce that all elements that require alternative text have meaningful information
6
8
  // https://github.com/brendanmorrell/eslint-plugin-styled-components-a11y/blob/master/docs/rules/alt-text.md
@@ -1,6 +1,11 @@
1
+ import { resolvePlugin } from '../resolve-plugin.mjs';
2
+
1
3
  // All testing-library + jest-dom rules loaded via jsPlugins (no native oxlint support).
2
4
  export const testingLibraryRules = {
3
- jsPlugins: ['eslint-plugin-testing-library', 'eslint-plugin-jest-dom'],
5
+ jsPlugins: [
6
+ resolvePlugin('eslint-plugin-testing-library'),
7
+ resolvePlugin('eslint-plugin-jest-dom'),
8
+ ],
4
9
  rules: {
5
10
  // Enforce async events to be awaited
6
11
  // https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/await-async-events.md
package/rules/unicorn.mjs CHANGED
@@ -54,6 +54,10 @@ export const unicornRules = {
54
54
  // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/explicit-length-check.html
55
55
  'unicorn/explicit-length-check': 'error',
56
56
 
57
+ // Enforce explicit delay argument for `setTimeout()` and `setInterval()`
58
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/explicit-timer-delay.html
59
+ 'unicorn/explicit-timer-delay': 'error',
60
+
57
61
  // Enforce a case style for filenames
58
62
  // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/filename-case.html
59
63
  // Decision: project-specific; consumers enforce their own filename conventions
@@ -133,6 +137,10 @@ export const unicornRules = {
133
137
  // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-await-in-promise-methods.html
134
138
  'unicorn/no-await-in-promise-methods': 'error',
135
139
 
140
+ // Disallow confusing uses of `Array#with()`
141
+ // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-confusing-array-with.html
142
+ 'unicorn/no-confusing-array-with': 'error',
143
+
136
144
  // Do not use leading/trailing space between `console.log` parameters
137
145
  // https://oxc.rs/docs/guide/usage/linter/rules/unicorn/no-console-spaces.html
138
146
  // Decision: formatter territory
package/rules/vitest.mjs CHANGED
@@ -1,9 +1,11 @@
1
+ import { resolvePlugin } from '../resolve-plugin.mjs';
2
+
1
3
  // Native oxlint vitest rules + jsPlugin rules from @vitest/eslint-plugin and eslint-plugin-no-only-tests
2
4
  export const vitestRules = {
3
5
  plugins: ['vitest'],
4
6
  jsPlugins: [
5
- { name: 'vitest-js', specifier: '@vitest/eslint-plugin' },
6
- 'eslint-plugin-no-only-tests',
7
+ { name: 'vitest-js', specifier: resolvePlugin('@vitest/eslint-plugin') },
8
+ resolvePlugin('eslint-plugin-no-only-tests'),
7
9
  ],
8
10
  rules: {
9
11
  // Require .test test file pattern