@wistia/oxlint-config 0.7.4 → 0.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/README.md CHANGED
@@ -12,9 +12,23 @@ Wistia's Oxlint configurations. This is a shared config package for [oxlint](htt
12
12
  ## How to install
13
13
 
14
14
  ```bash
15
- yarn add -D @wistia/oxlint-config oxlint
15
+ yarn add -D @wistia/oxlint-config oxlint eslint
16
16
  ```
17
17
 
18
+ > **Why `eslint`?** This package uses oxlint's [jsPlugins](https://oxc.rs/docs/guide/usage/linter/js-plugins) feature to run ESLint plugins (e.g. `eslint-plugin-import-x`, `@eslint-react/eslint-plugin`, `eslint-plugin-testing-library`, etc.) natively inside oxlint. These plugins import utilities from the `eslint` package at runtime, so it must be installed even though you won't run `eslint` directly.
19
+ >
20
+ > **Note:** jsPlugins do not support rules that rely on TypeScript type information. Any type-aware rules in this config use native oxlint rules instead.
21
+
22
+ ### Type-aware linting
23
+
24
+ The `typescriptConfig` enables [type-aware linting](https://oxc.rs/docs/guide/usage/linter/type-aware), which requires the `oxlint-tsgolint` package:
25
+
26
+ ```bash
27
+ yarn add -D oxlint-tsgolint
28
+ ```
29
+
30
+ `oxlint-tsgolint` is a separate Go-based tool that builds your TypeScript program using `typescript-go` and runs type-aware rules (e.g. detecting unhandled promises, unsafe assignments). Without it installed, type-aware rules will not run.
31
+
18
32
  ## Quick start
19
33
 
20
34
  Create an `oxlint.config.ts` in your project root:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wistia/oxlint-config",
3
- "version": "0.7.4",
3
+ "version": "0.8.0",
4
4
  "description": "Wistia's Oxlint configurations",
5
5
  "packageManager": "yarn@4.14.1",
6
6
  "type": "module",
@@ -42,6 +42,7 @@
42
42
  },
43
43
  "scripts": {
44
44
  "changeset": "changeset",
45
+ "disabled": "node scripts/list-disabled-rules.mjs",
45
46
  "format": "oxfmt .",
46
47
  "format:ci": "oxfmt --check .",
47
48
  "outdated": "yarn upgrade-interactive",
@@ -54,16 +55,16 @@
54
55
  "oxlint-tsgolint": ">= 1.0.0"
55
56
  },
56
57
  "dependencies": {
57
- "@eslint-react/eslint-plugin": "^5.7.6",
58
- "@vitest/eslint-plugin": "^1.6.16",
58
+ "@eslint-react/eslint-plugin": "^5.8.3",
59
+ "@vitest/eslint-plugin": "^1.6.17",
59
60
  "confusing-browser-globals": "^1.0.11",
60
61
  "eslint-plugin-barrel-files": "^3.0.1",
61
62
  "eslint-plugin-import-x": "^4.16.2",
62
63
  "eslint-plugin-jest-dom": "^5.5.0",
63
64
  "eslint-plugin-n": "^18.0.1",
64
65
  "eslint-plugin-no-only-tests": "^3.4.0",
65
- "eslint-plugin-playwright": "^2.10.2",
66
- "eslint-plugin-storybook": "^10.3.6",
66
+ "eslint-plugin-playwright": "^2.10.4",
67
+ "eslint-plugin-storybook": "^10.4.0",
67
68
  "eslint-plugin-styled-components": "^0.0.0",
68
69
  "eslint-plugin-styled-components-a11y": "^2.2.1",
69
70
  "eslint-plugin-testing-library": "^7.16.2",
@@ -72,12 +73,12 @@
72
73
  "devDependencies": {
73
74
  "@changesets/changelog-github": "^0.7.0",
74
75
  "@changesets/cli": "^2.31.0",
75
- "eslint": "^10.3.0",
76
- "oxfmt": "^0.48.0",
77
- "oxlint": "^1.64.0",
78
- "oxlint-tsgolint": "^0.22.1",
79
- "storybook": "^10.3.6",
80
- "vitest": "^4.1.5"
76
+ "eslint": "^10.4.0",
77
+ "oxfmt": "^0.51.0",
78
+ "oxlint": "^1.66.0",
79
+ "oxlint-tsgolint": "^0.23.0",
80
+ "storybook": "^10.4.0",
81
+ "vitest": "^4.1.7"
81
82
  },
82
83
  "engines": {
83
84
  "node": "^20.19.0 || ^22.13.0 || >=24 || >=26"
@@ -5,14 +5,17 @@ export const barrelFilesRules = {
5
5
  rules: {
6
6
  // Avoid barrel files
7
7
  // https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/docs/rules/avoid-barrel-files.md
8
+ // Decision: too opinionated for general use
8
9
  'eslint-plugin-barrel-files/avoid-barrel-files': 'off',
9
10
 
10
11
  // Avoid importing barrel files
11
12
  // https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/docs/rules/avoid-importing-barrel-files.md
13
+ // Decision: too opinionated for general use
12
14
  'eslint-plugin-barrel-files/avoid-importing-barrel-files': 'off',
13
15
 
14
16
  // Avoid namespace imports from barrel files
15
17
  // https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/docs/rules/avoid-namespace-import.md
18
+ // Decision: too opinionated for general use
16
19
  'eslint-plugin-barrel-files/avoid-namespace-import': 'off',
17
20
 
18
21
  // Avoid re-export all from barrel files
package/rules/base.mjs CHANGED
@@ -229,6 +229,7 @@ export const baseRules = {
229
229
 
230
230
  // Require braces around arrow function bodies
231
231
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/arrow-body-style.html
232
+ // Decision: stylistic choice best left to formatter
232
233
  'eslint/arrow-body-style': 'off',
233
234
 
234
235
  // Enforce the use of variables within the scope they are defined
@@ -271,6 +272,11 @@ export const baseRules = {
271
272
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/grouped-accessor-pairs.html
272
273
  'eslint/grouped-accessor-pairs': 'error',
273
274
 
275
+ // Require identifiers to match a specified regular expression
276
+ // https://oxc.rs/docs/guide/usage/linter/rules/eslint/id-match.html
277
+ // Decision: too opinionated for general use
278
+ 'eslint/id-match': 'off',
279
+
274
280
  // Enforce minimum and maximum identifier lengths
275
281
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/id-length.html
276
282
  'eslint/id-length': [
@@ -373,6 +379,14 @@ export const baseRules = {
373
379
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-implicit-coercion.html
374
380
  'eslint/no-implicit-coercion': 'error',
375
381
 
382
+ // Disallow declarations in the global scope
383
+ // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-implicit-globals.html
384
+ 'eslint/no-implicit-globals': 'error',
385
+
386
+ // Disallow the use of eval()-like methods
387
+ // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-implied-eval.html
388
+ 'eslint/no-implied-eval': 'error',
389
+
376
390
  // Disallow the use of the __iterator__ property
377
391
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-iterator.html
378
392
  'eslint/no-iterator': 'error',
@@ -399,7 +413,7 @@ export const baseRules = {
399
413
 
400
414
  // Disallow magic numbers
401
415
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-magic-numbers.html
402
- // decision: this rule is too noisy to be a default and was commonly disabled inline
416
+ // Decision: this rule is too noisy to be a default and was commonly disabled inline
403
417
  'eslint/no-magic-numbers': 'off',
404
418
 
405
419
  // Disallow use of chained assignment expressions
@@ -492,7 +506,7 @@ export const baseRules = {
492
506
 
493
507
  // Disallow specified modules when loaded by import
494
508
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-restricted-imports.html
495
- // decision: this should be set at a project-level config if necessary
509
+ // Decision: this should be set at a project-level config if necessary
496
510
  'eslint/no-restricted-imports': 'off',
497
511
 
498
512
  // Disallow assignment operators in return statements
@@ -576,6 +590,13 @@ export const baseRules = {
576
590
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/operator-assignment.html
577
591
  'eslint/operator-assignment': ['error', 'always'],
578
592
 
593
+ // Require using arrow functions for callbacks
594
+ // https://oxc.rs/docs/guide/usage/linter/rules/eslint/prefer-arrow-callback.html
595
+ 'eslint/prefer-arrow-callback': [
596
+ 'error',
597
+ { allowNamedFunctions: false, allowUnboundThis: true },
598
+ ],
599
+
579
600
  // Require const declarations for variables that are never reassigned after declared
580
601
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/prefer-const.html
581
602
  'eslint/prefer-const': ['error', { destructuring: 'any', ignoreReadBeforeAssign: true }],
@@ -607,6 +628,10 @@ export const baseRules = {
607
628
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/prefer-object-spread.html
608
629
  'eslint/prefer-object-spread': 'error',
609
630
 
631
+ // Disallow use of the RegExp constructor in favor of regular expression literals
632
+ // https://oxc.rs/docs/guide/usage/linter/rules/eslint/prefer-regex-literals.html
633
+ 'eslint/prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
634
+
610
635
  // Require using Error objects as Promise rejection reasons
611
636
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/prefer-promise-reject-errors.html
612
637
  'eslint/prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
@@ -657,134 +682,162 @@ export const baseRules = {
657
682
 
658
683
  // Enforce or disallow capitalization of the first letter of a comment
659
684
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/capitalized-comments.html
685
+ // Decision: too opinionated for general use
660
686
  'eslint/capitalized-comments': 'off',
661
687
 
662
688
  // Enforce a maximum cyclomatic complexity allowed in a program
663
689
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/complexity.html
690
+ // Decision: too opinionated for general use
664
691
  'eslint/complexity': 'off',
665
692
 
666
693
  // Require following curly brace conventions
667
694
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/curly.html
695
+ // Decision: stylistic choice best left to formatter
668
696
  'eslint/curly': 'off',
669
697
 
670
698
  // Require function names to match the name of the variable or property to which they are assigned
671
699
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/func-name-matching.html
700
+ // Decision: too opinionated for general use
672
701
  'eslint/func-name-matching': 'off',
673
702
 
674
703
  // Require or disallow initialization in variable declarations
675
704
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/init-declarations.html
705
+ // Decision: too opinionated for general use
676
706
  'eslint/init-declarations': 'off',
677
707
 
678
708
  // Require or disallow logical assignment operator shorthand
679
709
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/logical-assignment-operators.html
710
+ // Decision: too opinionated for general use
680
711
  'eslint/logical-assignment-operators': 'off',
681
712
 
682
713
  // Enforce a maximum depth that blocks can be nested
683
714
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/max-depth.html
715
+ // Decision: too opinionated for general use
684
716
  'eslint/max-depth': 'off',
685
717
 
686
718
  // Enforce a maximum number of lines per file
687
719
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/max-lines.html
720
+ // Decision: too opinionated for general use
688
721
  'eslint/max-lines': 'off',
689
722
 
690
723
  // Enforce a maximum number of lines of code in a function
691
724
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/max-lines-per-function.html
725
+ // Decision: too opinionated for general use
692
726
  'eslint/max-lines-per-function': 'off',
693
727
 
694
728
  // Enforce a maximum depth that callbacks can be nested
695
729
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/max-nested-callbacks.html
730
+ // Decision: too opinionated for general use
696
731
  'eslint/max-nested-callbacks': 'off',
697
732
 
698
733
  // Enforce a maximum number of parameters in function definitions
699
734
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/max-params.html
735
+ // Decision: too opinionated for general use
700
736
  'eslint/max-params': 'off',
701
737
 
702
738
  // Enforce a maximum number of statements allowed in function blocks
703
739
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/max-statements.html
740
+ // Decision: too opinionated for general use
704
741
  'eslint/max-statements': 'off',
705
742
 
706
743
  // Require regex literals to escape division operators
707
744
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-div-regex.html
745
+ // Decision: too opinionated for general use
708
746
  'eslint/no-div-regex': 'off',
709
747
 
710
748
  // Disallow duplicate module imports
711
749
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-duplicate-imports.html
750
+ // Decision: handled by import plugin
712
751
  'eslint/no-duplicate-imports': 'off',
713
752
 
714
753
  // Disallow null comparisons without type-checking operators
715
754
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-eq-null.html
755
+ // Decision: too opinionated for general use
716
756
  'eslint/no-eq-null': 'off',
717
757
 
718
758
  // Disallow inline comments after code
719
759
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-inline-comments.html
760
+ // Decision: inline comments are occasionally necessary
720
761
  'eslint/no-inline-comments': 'off',
721
762
 
722
763
  // Disallow negated conditions
723
764
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-negated-condition.html
765
+ // Decision: too opinionated for general use
724
766
  'eslint/no-negated-condition': 'off',
725
767
 
726
768
  // Disallow specified names in exports
727
769
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-restricted-exports.html
770
+ // Decision: requires project-specific configuration
728
771
  'eslint/no-restricted-exports': 'off',
729
772
 
730
773
  // Disallow certain properties on certain objects
731
774
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-restricted-properties.html
775
+ // Decision: requires project-specific configuration
732
776
  'eslint/no-restricted-properties': 'off',
733
777
 
734
778
  // Disallow ternary operators
735
779
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-ternary.html
780
+ // Decision: restricts valid language feature
736
781
  'eslint/no-ternary': 'off',
737
782
 
738
783
  // Disallow the use of undeclared variables unless mentioned in global comments
739
784
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-undef.html
785
+ // Decision: handled by TypeScript
740
786
  'eslint/no-undef': 'off',
741
787
 
742
788
  // Disallow the use of undefined as an identifier
743
789
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-undefined.html
790
+ // Decision: restricts valid language feature
744
791
  'eslint/no-undefined': 'off',
745
792
 
746
793
  // Disallow dangling underscores in identifiers
747
794
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-underscore-dangle.html
795
+ // Decision: too opinionated for general use
748
796
  'eslint/no-underscore-dangle': 'off',
749
797
 
750
798
  // Disallow confusing multiline expressions
751
799
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unexpected-multiline.html
800
+ // Decision: stylistic choice best left to formatter
752
801
  'eslint/no-unexpected-multiline': 'off',
753
802
 
754
803
  // Disallow assignments that are never used
755
804
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-useless-assignment.html
805
+ // Decision: handled by TypeScript noUnusedLocals
756
806
  'eslint/no-useless-assignment': 'off',
757
807
 
758
808
  // Disallow unnecessary calls to .call() and .apply()
759
809
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-useless-call.html
810
+ // Decision: too opinionated for general use
760
811
  'eslint/no-useless-call': 'off',
761
812
 
762
813
  // Disallow specified warning terms in comments
763
814
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-warning-comments.html
815
+ // Decision: too opinionated for general use
764
816
  'eslint/no-warning-comments': 'off',
765
817
 
766
818
  // Require or disallow method and property shorthand syntax for object literals
767
819
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/object-shorthand.html
820
+ // Decision: feels overprescriptive to enforce this style choice
768
821
  'eslint/object-shorthand': 'off',
769
822
 
770
- // Disallow use of Object.create(null) in favor of using regex literals
771
- // https://oxc.rs/docs/guide/usage/linter/rules/eslint/prefer-regex-literals.html
772
- 'eslint/prefer-regex-literals': 'off',
773
-
774
823
  // Enforce the use of u or v flag on regular expressions
775
824
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/require-unicode-regexp.html
825
+ // Decision: too opinionated for general use
776
826
  'eslint/require-unicode-regexp': 'off',
777
827
 
778
828
  // Enforce sorted import declarations within modules
779
829
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/sort-imports.html
830
+ // Decision: handled by import plugin
780
831
  'eslint/sort-imports': 'off',
781
832
 
782
833
  // Require object keys to be sorted
783
834
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/sort-keys.html
835
+ // Decision: too opinionated for general use
784
836
  'eslint/sort-keys': 'off',
785
837
 
786
838
  // Require variables within the same declaration block to be sorted
787
839
  // https://oxc.rs/docs/guide/usage/linter/rules/eslint/sort-vars.html
840
+ // Decision: too opinionated for general use
788
841
  'eslint/sort-vars': 'off',
789
842
 
790
843
  //oxc rules - these are bug-catchers that oxlint can detect natively.
@@ -851,6 +904,7 @@ export const baseRules = {
851
904
 
852
905
  // Disallow branches in if/else that share identical code
853
906
  // https://oxc.rs/docs/guide/usage/linter/rules/oxc/branches-sharing-code.html
907
+ // Decision: too noisy in practice
854
908
  'oxc/branches-sharing-code': 'off',
855
909
 
856
910
  // Disallow misrefactored compound assignment operators
@@ -863,18 +917,22 @@ export const baseRules = {
863
917
 
864
918
  // Disallow use of async/await syntax
865
919
  // https://oxc.rs/docs/guide/usage/linter/rules/oxc/no-async-await.html
920
+ // Decision: restricts valid language feature
866
921
  'oxc/no-async-await': 'off',
867
922
 
868
923
  // Disallow use of async functions as Express endpoint handlers without error handling
869
924
  // https://oxc.rs/docs/guide/usage/linter/rules/oxc/no-async-endpoint-handlers.html
925
+ // Decision: framework-specific, not universally applicable
870
926
  'oxc/no-async-endpoint-handlers': 'off',
871
927
 
872
928
  // Disallow barrel files (index files that re-export from other modules)
873
929
  // https://oxc.rs/docs/guide/usage/linter/rules/oxc/no-barrel-file.html
930
+ // Decision: handled by barrel-files plugin
874
931
  'oxc/no-barrel-file': 'off',
875
932
 
876
933
  // Disallow TypeScript const enums
877
934
  // https://oxc.rs/docs/guide/usage/linter/rules/oxc/no-const-enum.html
935
+ // Decision: too opinionated for general use
878
936
  'oxc/no-const-enum': 'off',
879
937
 
880
938
  // Disallow spreading keys from a map-like object into an object literal
@@ -883,14 +941,17 @@ export const baseRules = {
883
941
 
884
942
  // Disallow use of optional chaining
885
943
  // https://oxc.rs/docs/guide/usage/linter/rules/oxc/no-optional-chaining.html
944
+ // Decision: restricts valid language feature
886
945
  'oxc/no-optional-chaining': 'off',
887
946
 
888
947
  // Disallow use of rest and spread properties
889
948
  // https://oxc.rs/docs/guide/usage/linter/rules/oxc/no-rest-spread-properties.html
949
+ // Decision: restricts valid language feature
890
950
  'oxc/no-rest-spread-properties': 'off',
891
951
 
892
952
  // Disallow use of this in exported functions
893
953
  // https://oxc.rs/docs/guide/usage/linter/rules/oxc/no-this-in-exported-function.html
954
+ // Decision: too opinionated for general use
894
955
  'oxc/no-this-in-exported-function': 'off',
895
956
  },
896
957
  };