@wistia/oxlint-config 1.7.1 → 1.7.3

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.
@@ -1,9 +1,9 @@
1
1
  import { defineConfig } from 'oxlint';
2
+ import { barrelFilesRules } from '../rules/barrel-files.mjs';
2
3
  import { baseRules } from '../rules/base.mjs';
4
+ import { customRules } from '../rules/custom.mjs';
3
5
  import { importRules } from '../rules/import.mjs';
4
6
  import { promiseRules } from '../rules/promise.mjs';
5
- import { barrelFilesRules } from '../rules/barrel-files.mjs';
6
- import { customRules } from '../rules/custom.mjs';
7
7
  import { unicornRules } from '../rules/unicorn.mjs';
8
8
 
9
9
  export default defineConfig({
package/configs/react.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineConfig } from 'oxlint';
2
- import { reactRules } from '../rules/react.mjs';
3
2
  import { reactA11yRules } from '../rules/react-a11y.mjs';
3
+ import { reactRules } from '../rules/react.mjs';
4
4
 
5
5
  export default defineConfig({
6
6
  plugins: [...reactRules.plugins, ...reactA11yRules.plugins],
@@ -1,6 +1,6 @@
1
1
  import { defineConfig } from 'oxlint';
2
- import { storybookRules } from '../rules/storybook.mjs';
3
2
  import { customRules } from '../rules/custom.mjs';
3
+ import { storybookRules } from '../rules/storybook.mjs';
4
4
 
5
5
  export default defineConfig({
6
6
  overrides: [
@@ -1,10 +1,10 @@
1
1
  import { defineConfig } from 'oxlint';
2
+ import { barrelFilesRules } from '../rules/barrel-files.mjs';
2
3
  import { baseRules } from '../rules/base.mjs';
4
+ import { customRules } from '../rules/custom.mjs';
3
5
  import { importRules } from '../rules/import.mjs';
4
6
  import { promiseRules } from '../rules/promise.mjs';
5
7
  import { typescriptRules } from '../rules/typescript.mjs';
6
- import { barrelFilesRules } from '../rules/barrel-files.mjs';
7
- import { customRules } from '../rules/custom.mjs';
8
8
  import { unicornRules } from '../rules/unicorn.mjs';
9
9
 
10
10
  export default defineConfig({
package/oxfmtConfig.mjs CHANGED
@@ -1,4 +1,27 @@
1
- import { oxfmtConfig } from './oxfmtConfig.js';
2
1
  import { defineConfig } from 'oxfmt';
3
2
 
3
+ export const oxfmtConfig = {
4
+ printWidth: 100,
5
+ singleQuote: true,
6
+ trailingComma: 'all',
7
+ singleAttributePerLine: true,
8
+ sortImports: {
9
+ groups: [
10
+ 'type-builtin',
11
+ 'type-external',
12
+ ['type-internal', 'type-parent', 'type-sibling', 'type-index'],
13
+ 'value-builtin',
14
+ 'value-external',
15
+ 'value-internal',
16
+ 'value-index',
17
+ ['value-parent', 'value-sibling'],
18
+ 'unknown',
19
+ ],
20
+ newlinesBetween: false,
21
+ },
22
+ ignorePatterns: ['node_modules/**', '.yarn/**'],
23
+ sortPackageJson: false,
24
+ };
25
+
26
+ // oxlint-disable-next-line import-x/no-default-export
4
27
  export default defineConfig(oxfmtConfig);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wistia/oxlint-config",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
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",
@@ -51,8 +52,8 @@
51
52
  "scripts": {
52
53
  "changeset": "changeset",
53
54
  "disabled": "node scripts/list-disabled-rules.mjs",
54
- "format": "oxfmt .",
55
- "format:ci": "oxfmt --check .",
55
+ "format": "oxfmt -c oxfmt.config.mjs .",
56
+ "format:ci": "oxfmt -c oxfmt.config.mjs --check .",
56
57
  "outdated": "yarn upgrade-interactive",
57
58
  "release": "changeset publish",
58
59
  "test": "vitest run --exclude test/validate-configs.test.mjs",
@@ -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/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/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