@venizia/dev-configs 0.2.1 → 0.3.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.
Files changed (93) hide show
  1. package/README.md +167 -33
  2. package/dist/{compile.d.ts → compilers/bun.d.ts} +1 -1
  3. package/dist/compilers/bun.d.ts.map +1 -0
  4. package/dist/{compile.js → compilers/bun.js} +8 -9
  5. package/dist/compilers/bun.js.map +1 -0
  6. package/dist/compilers/index.d.ts +2 -0
  7. package/dist/compilers/index.d.ts.map +1 -0
  8. package/dist/compilers/index.js +18 -0
  9. package/dist/compilers/index.js.map +1 -0
  10. package/dist/formatters/index.d.ts +3 -0
  11. package/dist/formatters/index.d.ts.map +1 -0
  12. package/dist/formatters/index.js +19 -0
  13. package/dist/formatters/index.js.map +1 -0
  14. package/dist/formatters/oxfmt.d.ts +14 -0
  15. package/dist/formatters/oxfmt.d.ts.map +1 -0
  16. package/dist/formatters/oxfmt.js +24 -0
  17. package/dist/formatters/oxfmt.js.map +1 -0
  18. package/dist/formatters/prettier.d.ts +3 -0
  19. package/dist/formatters/prettier.d.ts.map +1 -0
  20. package/dist/{prettier.js → formatters/prettier.js} +2 -2
  21. package/dist/formatters/prettier.js.map +1 -0
  22. package/dist/index.d.ts +3 -4
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +3 -4
  25. package/dist/index.js.map +1 -1
  26. package/dist/linters/eslint.d.ts +20 -0
  27. package/dist/linters/eslint.d.ts.map +1 -0
  28. package/dist/linters/eslint.js +152 -0
  29. package/dist/linters/eslint.js.map +1 -0
  30. package/dist/linters/index.d.ts +5 -0
  31. package/dist/linters/index.d.ts.map +1 -0
  32. package/dist/linters/index.js +21 -0
  33. package/dist/linters/index.js.map +1 -0
  34. package/dist/linters/oxlint.d.ts +19 -0
  35. package/dist/linters/oxlint.d.ts.map +1 -0
  36. package/dist/linters/oxlint.js +166 -0
  37. package/dist/linters/oxlint.js.map +1 -0
  38. package/dist/linters/react.d.ts +58 -0
  39. package/dist/linters/react.d.ts.map +1 -0
  40. package/dist/linters/react.js +177 -0
  41. package/dist/linters/react.js.map +1 -0
  42. package/dist/linters/rules/common.d.ts +6 -0
  43. package/dist/linters/rules/common.d.ts.map +1 -0
  44. package/dist/linters/rules/common.js +3 -0
  45. package/dist/linters/rules/common.js.map +1 -0
  46. package/dist/linters/rules/eqeqeq.rule.d.ts +10 -0
  47. package/dist/linters/rules/eqeqeq.rule.d.ts.map +1 -0
  48. package/dist/linters/rules/eqeqeq.rule.js +13 -0
  49. package/dist/linters/rules/eqeqeq.rule.js.map +1 -0
  50. package/dist/linters/rules/index.d.ts +9 -0
  51. package/dist/linters/rules/index.d.ts.map +1 -0
  52. package/dist/linters/rules/index.js +25 -0
  53. package/dist/linters/rules/index.js.map +1 -0
  54. package/dist/linters/rules/naming-convention.rule.d.ts +20 -0
  55. package/dist/linters/rules/naming-convention.rule.d.ts.map +1 -0
  56. package/dist/linters/rules/naming-convention.rule.js +64 -0
  57. package/dist/linters/rules/naming-convention.rule.js.map +1 -0
  58. package/dist/linters/rules/no-restricted-imports.rule.d.ts +17 -0
  59. package/dist/linters/rules/no-restricted-imports.rule.d.ts.map +1 -0
  60. package/dist/linters/rules/no-restricted-imports.rule.js +19 -0
  61. package/dist/linters/rules/no-restricted-imports.rule.js.map +1 -0
  62. package/dist/linters/rules/no-restricted-properties.rule.d.ts +22 -0
  63. package/dist/linters/rules/no-restricted-properties.rule.d.ts.map +1 -0
  64. package/dist/linters/rules/no-restricted-properties.rule.js +24 -0
  65. package/dist/linters/rules/no-restricted-properties.rule.js.map +1 -0
  66. package/dist/linters/rules/no-unused-vars.rule.d.ts +12 -0
  67. package/dist/linters/rules/no-unused-vars.rule.d.ts.map +1 -0
  68. package/dist/linters/rules/no-unused-vars.rule.js +13 -0
  69. package/dist/linters/rules/no-unused-vars.rule.js.map +1 -0
  70. package/dist/linters/rules/prefer-nullish-coalescing.rule.d.ts +12 -0
  71. package/dist/linters/rules/prefer-nullish-coalescing.rule.d.ts.map +1 -0
  72. package/dist/linters/rules/prefer-nullish-coalescing.rule.js +13 -0
  73. package/dist/linters/rules/prefer-nullish-coalescing.rule.js.map +1 -0
  74. package/dist/linters/rules/switch-case-braces.rule.d.ts +10 -0
  75. package/dist/linters/rules/switch-case-braces.rule.d.ts.map +1 -0
  76. package/dist/linters/rules/switch-case-braces.rule.js +13 -0
  77. package/dist/linters/rules/switch-case-braces.rule.js.map +1 -0
  78. package/package.json +46 -16
  79. package/{tsconfig → src/tsconfig}/tsconfig.base.json +2 -2
  80. package/{tsconfig → src/tsconfig}/tsconfig.common.json +1 -1
  81. package/dist/compile.d.ts.map +0 -1
  82. package/dist/compile.js.map +0 -1
  83. package/dist/eslint.d.ts +0 -3
  84. package/dist/eslint.d.ts.map +0 -1
  85. package/dist/eslint.js +0 -25
  86. package/dist/eslint.js.map +0 -1
  87. package/dist/prettier.d.ts +0 -3
  88. package/dist/prettier.d.ts.map +0 -1
  89. package/dist/prettier.js.map +0 -1
  90. package/dist/react.d.ts +0 -32
  91. package/dist/react.d.ts.map +0 -1
  92. package/dist/react.js +0 -111
  93. package/dist/react.js.map +0 -1
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.namingConventionConfigs = exports.eslintConfigs = void 0;
7
+ const js_1 = __importDefault(require("@eslint/js"));
8
+ const config_1 = require("eslint/config");
9
+ const eslint_plugin_n_1 = __importDefault(require("eslint-plugin-n"));
10
+ const recommended_1 = __importDefault(require("eslint-plugin-prettier/recommended"));
11
+ const eslint_plugin_unicorn_1 = __importDefault(require("eslint-plugin-unicorn"));
12
+ const typescript_eslint_1 = __importDefault(require("typescript-eslint"));
13
+ const rules_1 = require("./rules");
14
+ /** Every file the preset lints. */
15
+ const SOURCE_FILES = [
16
+ '**/*.js',
17
+ '**/*.cjs',
18
+ '**/*.mjs',
19
+ '**/*.jsx',
20
+ '**/*.ts',
21
+ '**/*.cts',
22
+ '**/*.mts',
23
+ '**/*.tsx',
24
+ ];
25
+ /** Rules that stay off: the type checker, the formatter or the framework's own style covers them. */
26
+ const OFF_RULES = {
27
+ 'no-constant-condition': 'off',
28
+ 'no-undef': 'off',
29
+ 'no-unused-vars': 'off',
30
+ 'no-mixed-operators': 'off',
31
+ 'no-inner-declarations': 'off',
32
+ 'no-dupe-class-members': 'off',
33
+ 'no-redeclare': 'off',
34
+ 'no-invalid-this': 'off',
35
+ 'no-shadow': 'off',
36
+ 'no-return-await': 'off',
37
+ camelcase: 'off',
38
+ '@typescript-eslint/no-explicit-any': 'off',
39
+ '@typescript-eslint/no-unsafe-function-type': 'off',
40
+ '@typescript-eslint/no-this-alias': 'off',
41
+ '@typescript-eslint/no-empty-object-type': 'off',
42
+ '@typescript-eslint/no-invalid-void-type': 'off',
43
+ '@typescript-eslint/no-confusing-void-expression': 'off',
44
+ '@typescript-eslint/no-extraneous-class': 'off',
45
+ '@typescript-eslint/no-require-imports': 'off',
46
+ '@typescript-eslint/strict-boolean-expressions': 'off',
47
+ '@typescript-eslint/explicit-function-return-type': 'off',
48
+ '@typescript-eslint/explicit-member-accessibility': 'off',
49
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
50
+ '@typescript-eslint/array-type': 'off',
51
+ '@typescript-eslint/no-non-null-assertion': 'off',
52
+ '@typescript-eslint/no-empty-function': 'off',
53
+ '@typescript-eslint/consistent-type-assertions': 'off',
54
+ '@typescript-eslint/no-misused-promises': 'off',
55
+ };
56
+ /** The LoopBack 4 rule set, on top of the recommended presets. */
57
+ const STRICT_RULES = {
58
+ 'prefer-const': 'error',
59
+ 'no-var': 'error',
60
+ curly: ['error', 'all'],
61
+ 'no-new-wrappers': 'error',
62
+ 'no-throw-literal': 'error',
63
+ 'no-unused-expressions': 'error',
64
+ eqeqeq: ['error', 'smart'],
65
+ 'no-void': 'error',
66
+ 'no-useless-escape': 'warn',
67
+ 'no-caller': 'error',
68
+ 'n/prefer-node-protocol': ['error'],
69
+ '@typescript-eslint/adjacent-overload-signatures': 'error',
70
+ '@typescript-eslint/prefer-for-of': 'error',
71
+ '@typescript-eslint/unified-signatures': 'error',
72
+ '@typescript-eslint/no-invalid-this': ['error'],
73
+ '@typescript-eslint/no-use-before-define': 'error',
74
+ '@typescript-eslint/no-shadow': 'error',
75
+ '@typescript-eslint/ban-ts-comment': 'error',
76
+ '@typescript-eslint/no-namespace': 'error',
77
+ '@typescript-eslint/await-thenable': 'error',
78
+ '@typescript-eslint/no-floating-promises': 'error',
79
+ '@typescript-eslint/prefer-optional-chain': 'error',
80
+ '@typescript-eslint/prefer-nullish-coalescing': [
81
+ 'error',
82
+ { allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: true },
83
+ ],
84
+ '@typescript-eslint/return-await': 'error',
85
+ };
86
+ /**
87
+ * The full ESLint preset, owned here: the LoopBack 4 rule set on the ESLint, typescript-eslint and
88
+ * Prettier recommended presets, type-aware through the project service. A project on oxlint uses
89
+ * `oxlintConfigs` + `namingConventionConfigs` instead.
90
+ */
91
+ exports.eslintConfigs = (0, config_1.defineConfig)([
92
+ js_1.default.configs.recommended,
93
+ typescript_eslint_1.default.configs.recommended,
94
+ // Last of the presets, so it turns off every stylistic rule that would fight the formatter.
95
+ recommended_1.default,
96
+ {
97
+ files: SOURCE_FILES,
98
+ languageOptions: {
99
+ parserOptions: {
100
+ // Finds each file's tsconfig; the default project covers root-level scripts and configs.
101
+ projectService: { allowDefaultProject: ['*.js', '*.cjs', '*.mjs', '.*.js'] },
102
+ },
103
+ },
104
+ plugins: { n: eslint_plugin_n_1.default, unicorn: eslint_plugin_unicorn_1.default },
105
+ rules: {
106
+ ...OFF_RULES,
107
+ ...STRICT_RULES,
108
+ '@typescript-eslint/no-unused-vars': rules_1.NoUnusedVarsRule.build(),
109
+ [rules_1.NoRestrictedImportsRule.NAME]: rules_1.NoRestrictedImportsRule.build(),
110
+ [rules_1.SwitchCaseBracesRule.NAME]: rules_1.SwitchCaseBracesRule.build(),
111
+ [rules_1.NamingConventionRule.NAME]: rules_1.NamingConventionRule.build(),
112
+ },
113
+ },
114
+ {
115
+ ignores: [
116
+ '**/node_modules/',
117
+ '**/*.d.ts',
118
+ '**/build/',
119
+ '**/dist/',
120
+ '**/release/',
121
+ '**/babel.config.*',
122
+ '**/.babelrc.*',
123
+ '**/eslint.config.*',
124
+ '**/.eslintrc.*',
125
+ '**/.prettierrc.*',
126
+ ],
127
+ },
128
+ ]);
129
+ /**
130
+ * The one rule of `eslintConfigs` that oxlint cannot run yet, as a standalone ESLint preset to run
131
+ * next to `oxlintConfigs`. It needs no type information, so ESLint stays fast.
132
+ *
133
+ * ```js
134
+ * // .configs/eslint.config.mts
135
+ * import { namingConventionConfigs } from '@venizia/dev-configs/linters';
136
+ *
137
+ * export default namingConventionConfigs;
138
+ * ```
139
+ */
140
+ exports.namingConventionConfigs = [
141
+ // Global: ESLint does not read .gitignore, and still walks plain .js files no config claims.
142
+ { ignores: ['**/dist/**', '**/build/**', '**/coverage/**', '**/*.d.ts', '**/*.{js,cjs,mjs}'] },
143
+ {
144
+ files: ['**/*.{ts,tsx,mts,cts}'],
145
+ languageOptions: { parser: typescript_eslint_1.default.parser },
146
+ plugins: { '@typescript-eslint': typescript_eslint_1.default.plugin },
147
+ // oxlint owns every other rule, so the disable comments for them are not ESLint's to judge.
148
+ linterOptions: { reportUnusedDisableDirectives: 'off' },
149
+ rules: { [rules_1.NamingConventionRule.NAME]: rules_1.NamingConventionRule.build() },
150
+ },
151
+ ];
152
+ //# sourceMappingURL=eslint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eslint.js","sourceRoot":"","sources":["../../src/linters/eslint.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,0CAA6C;AAC7C,sEAAgC;AAChC,qFAAqE;AACrE,kFAA4C;AAC5C,0EAAyC;AACzC,mCAKiB;AA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,CAAC,KAAK,EAAE;SAC1D;KACF;IACD;QACE,OAAO,EAAE;YACP,kBAAkB;YAClB,WAAW;YACX,WAAW;YACX,UAAU;YACV,aAAa;YACb,mBAAmB;YACnB,eAAe;YACf,oBAAoB;YACpB,gBAAgB;YAChB,kBAAkB;SACnB;KACF;CACF,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACU,QAAA,uBAAuB,GAAoB;IACtD,6FAA6F;IAC7F,EAAE,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,WAAW,EAAE,mBAAmB,CAAC,EAAE;IAC9F;QACE,KAAK,EAAE,CAAC,uBAAuB,CAAC;QAChC,eAAe,EAAE,EAAE,MAAM,EAAE,2BAAQ,CAAC,MAAuB,EAAE;QAC7D,OAAO,EAAE,EAAE,oBAAoB,EAAE,2BAAQ,CAAC,MAAe,EAAE;QAC3D,4FAA4F;QAC5F,aAAa,EAAE,EAAE,6BAA6B,EAAE,KAAK,EAAE;QACvD,KAAK,EAAE,EAAE,CAAC,4BAAoB,CAAC,IAAI,CAAC,EAAE,4BAAoB,CAAC,KAAK,EAAE,EAAE;KACrE;CACF,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './eslint';
2
+ export * from './oxlint';
3
+ export * from './react';
4
+ export * from './rules';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/linters/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./eslint"), exports);
18
+ __exportStar(require("./oxlint"), exports);
19
+ __exportStar(require("./react"), exports);
20
+ __exportStar(require("./rules"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/linters/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,0CAAwB"}
@@ -0,0 +1,19 @@
1
+ import type { OxlintConfig } from 'oxlint';
2
+ /**
3
+ * The oxlint port of `eslintConfigs`, generated with `@oxlint/migrate` and kept rule for rule.
4
+ * Type-aware rules (`no-floating-promises`, `return-await`, ...) need `oxlint-tsgolint` installed.
5
+ *
6
+ * Not ported: `@typescript-eslint/naming-convention` (oxlint has no equivalent yet - keep it in
7
+ * ESLint), `@typescript-eslint/prefer-optional-chain` (oxlint nursery), `no-invalid-this` (covered
8
+ * by `noImplicitThis` in `tsconfig.base.json`). `n/prefer-node-protocol` maps to the unicorn rule.
9
+ *
10
+ * ```ts
11
+ * // .configs/oxlint.config.mts
12
+ * import { defineConfig } from 'oxlint';
13
+ * import { oxlintConfigs } from '@venizia/dev-configs/linters';
14
+ *
15
+ * export default defineConfig(oxlintConfigs);
16
+ * ```
17
+ */
18
+ export declare const oxlintConfigs: OxlintConfig;
19
+ //# sourceMappingURL=oxlint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oxlint.d.ts","sourceRoot":"","sources":["../../src/linters/oxlint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAa3C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,EAAE,YAgJ3B,CAAC"}
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.oxlintConfigs = void 0;
4
+ const rules_1 = require("./rules");
5
+ /** File globs the rules are scoped to. */
6
+ const TS_FILES = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'];
7
+ const JS_TS_FILES = ['**/*.js', '**/*.cjs', '**/*.mjs', '**/*.jsx', ...TS_FILES];
8
+ /**
9
+ * The oxlint port of `eslintConfigs`, generated with `@oxlint/migrate` and kept rule for rule.
10
+ * Type-aware rules (`no-floating-promises`, `return-await`, ...) need `oxlint-tsgolint` installed.
11
+ *
12
+ * Not ported: `@typescript-eslint/naming-convention` (oxlint has no equivalent yet - keep it in
13
+ * ESLint), `@typescript-eslint/prefer-optional-chain` (oxlint nursery), `no-invalid-this` (covered
14
+ * by `noImplicitThis` in `tsconfig.base.json`). `n/prefer-node-protocol` maps to the unicorn rule.
15
+ *
16
+ * ```ts
17
+ * // .configs/oxlint.config.mts
18
+ * import { defineConfig } from 'oxlint';
19
+ * import { oxlintConfigs } from '@venizia/dev-configs/linters';
20
+ *
21
+ * export default defineConfig(oxlintConfigs);
22
+ * ```
23
+ */
24
+ exports.oxlintConfigs = {
25
+ plugins: ['typescript', 'unicorn'],
26
+ categories: { correctness: 'off' },
27
+ options: { typeAware: true },
28
+ env: { builtin: true },
29
+ ignorePatterns: ['**/node_modules/', '**/*.d.ts', '**/build/', '**/dist/', '**/release/'],
30
+ rules: {
31
+ // eslint:recommended
32
+ 'constructor-super': 'error',
33
+ 'for-direction': 'error',
34
+ 'getter-return': 'error',
35
+ 'no-async-promise-executor': 'error',
36
+ 'no-case-declarations': 'error',
37
+ 'no-class-assign': 'error',
38
+ 'no-compare-neg-zero': 'error',
39
+ 'no-cond-assign': 'error',
40
+ 'no-const-assign': 'error',
41
+ 'no-constant-binary-expression': 'error',
42
+ 'no-constant-condition': 'error',
43
+ 'no-control-regex': 'error',
44
+ 'no-debugger': 'error',
45
+ 'no-delete-var': 'error',
46
+ 'no-dupe-else-if': 'error',
47
+ 'no-dupe-keys': 'error',
48
+ 'no-duplicate-case': 'error',
49
+ 'no-empty': 'error',
50
+ 'no-empty-character-class': 'error',
51
+ 'no-empty-pattern': 'error',
52
+ 'no-empty-static-block': 'error',
53
+ 'no-ex-assign': 'error',
54
+ 'no-extra-boolean-cast': 'error',
55
+ 'no-fallthrough': 'error',
56
+ 'no-func-assign': 'error',
57
+ 'no-global-assign': 'error',
58
+ 'no-import-assign': 'error',
59
+ 'no-invalid-regexp': 'error',
60
+ 'no-irregular-whitespace': 'error',
61
+ 'no-loss-of-precision': 'error',
62
+ 'no-misleading-character-class': 'error',
63
+ 'no-new-native-nonconstructor': 'error',
64
+ 'no-nonoctal-decimal-escape': 'error',
65
+ 'no-obj-calls': 'error',
66
+ 'no-prototype-builtins': 'error',
67
+ 'no-regex-spaces': 'error',
68
+ 'no-self-assign': 'error',
69
+ 'no-setter-return': 'error',
70
+ 'no-shadow-restricted-names': 'error',
71
+ 'no-sparse-arrays': 'error',
72
+ 'no-this-before-super': 'error',
73
+ 'no-unassigned-vars': 'error',
74
+ 'no-unreachable': 'error',
75
+ 'no-unsafe-finally': 'error',
76
+ 'no-unsafe-negation': 'error',
77
+ 'no-unsafe-optional-chaining': 'error',
78
+ 'no-unused-labels': 'error',
79
+ 'no-unused-private-class-members': 'error',
80
+ 'no-useless-backreference': 'error',
81
+ 'no-useless-catch': 'error',
82
+ 'no-with': 'error',
83
+ 'preserve-caught-error': 'error',
84
+ 'require-yield': 'error',
85
+ 'use-isnan': 'error',
86
+ 'valid-typeof': 'error',
87
+ 'no-array-constructor': 'error',
88
+ // Strict rules on top
89
+ [rules_1.NoUnusedVarsRule.NAME]: rules_1.NoUnusedVarsRule.build(),
90
+ 'no-useless-escape': 'warn',
91
+ 'no-unused-expressions': 'error',
92
+ 'no-new-wrappers': 'error',
93
+ 'no-throw-literal': 'error',
94
+ [rules_1.EqeqeqRule.NAME]: rules_1.EqeqeqRule.build(),
95
+ 'no-void': 'error',
96
+ 'no-caller': 'error',
97
+ 'no-shadow': 'error',
98
+ 'no-use-before-define': 'error',
99
+ [rules_1.SwitchCaseBracesRule.NAME]: rules_1.SwitchCaseBracesRule.build(),
100
+ 'unicorn/prefer-node-protocol': 'error',
101
+ // typescript-eslint
102
+ 'typescript/ban-ts-comment': 'error',
103
+ 'typescript/no-duplicate-enum-values': 'error',
104
+ 'typescript/no-empty-object-type': 'error',
105
+ 'typescript/no-extra-non-null-assertion': 'error',
106
+ 'typescript/no-misused-new': 'error',
107
+ 'typescript/no-namespace': 'error',
108
+ 'typescript/no-non-null-asserted-optional-chain': 'error',
109
+ 'typescript/no-this-alias': 'error',
110
+ 'typescript/no-unnecessary-type-constraint': 'error',
111
+ 'typescript/no-unsafe-declaration-merging': 'error',
112
+ 'typescript/no-unsafe-function-type': 'error',
113
+ 'typescript/no-wrapper-object-types': 'error',
114
+ 'typescript/prefer-as-const': 'error',
115
+ 'typescript/prefer-namespace-keyword': 'error',
116
+ 'typescript/triple-slash-reference': 'error',
117
+ 'typescript/adjacent-overload-signatures': 'error',
118
+ 'typescript/prefer-for-of': 'error',
119
+ 'typescript/unified-signatures': 'error',
120
+ // typescript-eslint, type-aware
121
+ 'typescript/await-thenable': 'error',
122
+ 'typescript/no-floating-promises': 'error',
123
+ [rules_1.PreferNullishCoalescingRule.NAME]: rules_1.PreferNullishCoalescingRule.build(),
124
+ 'typescript/return-await': 'error',
125
+ },
126
+ overrides: [
127
+ {
128
+ // TypeScript itself reports these.
129
+ files: TS_FILES,
130
+ rules: {
131
+ 'constructor-super': 'off',
132
+ 'getter-return': 'off',
133
+ 'no-class-assign': 'off',
134
+ 'no-const-assign': 'off',
135
+ 'no-dupe-keys': 'off',
136
+ 'no-func-assign': 'off',
137
+ 'no-import-assign': 'off',
138
+ 'no-new-native-nonconstructor': 'off',
139
+ 'no-obj-calls': 'off',
140
+ 'no-setter-return': 'off',
141
+ 'no-this-before-super': 'off',
142
+ 'no-unreachable': 'off',
143
+ 'no-unsafe-negation': 'off',
144
+ 'no-with': 'off',
145
+ 'no-var': 'error',
146
+ 'prefer-const': 'error',
147
+ 'prefer-rest-params': 'error',
148
+ 'prefer-spread': 'error',
149
+ },
150
+ },
151
+ {
152
+ files: JS_TS_FILES,
153
+ rules: {
154
+ 'no-constant-condition': 'off',
155
+ 'prefer-const': 'error',
156
+ 'no-var': 'error',
157
+ curly: ['error', 'all'],
158
+ [rules_1.NoRestrictedImportsRule.NAME]: rules_1.NoRestrictedImportsRule.build(),
159
+ 'typescript/no-unsafe-function-type': 'off',
160
+ 'typescript/no-this-alias': 'off',
161
+ 'typescript/no-empty-object-type': 'off',
162
+ },
163
+ },
164
+ ],
165
+ };
166
+ //# sourceMappingURL=oxlint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oxlint.js","sourceRoot":"","sources":["../../src/linters/oxlint.ts"],"names":[],"mappings":";;;AACA,mCAMiB;AAEjB,0CAA0C;AAC1C,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AACjE,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC,CAAC;AAEjF;;;;;;;;;;;;;;;GAeG;AACU,QAAA,aAAa,GAAiB;IACzC,OAAO,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC;IAClC,UAAU,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;IAClC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;IAC5B,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IACtB,cAAc,EAAE,CAAC,kBAAkB,EAAE,W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'oxlint';
3
+ /** Without `configs`: each plugin types its presets its own way, and only the rules are used here. */
4
+ type TRulesPlugin = Omit<ESLint.Plugin, 'configs'>;
5
+ export interface IReactEslintPlugins {
6
+ react: TRulesPlugin;
7
+ reactHooks: TRulesPlugin;
8
+ jsxA11y: TRulesPlugin;
9
+ }
10
+ /**
11
+ * The base preset plus what a React frontend needs on top: the React, hooks and accessibility rules.
12
+ * Frontend code is held to the backend's standard - no floating promise, no `void`, no use before
13
+ * declaration - so nothing in the base is relaxed. The plugins come in as options, so a backend that
14
+ * never calls this installs none of them.
15
+ *
16
+ * ```js
17
+ * import react from 'eslint-plugin-react';
18
+ * import reactHooks from 'eslint-plugin-react-hooks';
19
+ * import jsxA11y from 'eslint-plugin-jsx-a11y';
20
+ *
21
+ * export default ReactEslintConfigs.create({ plugins: { react, reactHooks, jsxA11y } });
22
+ * ```
23
+ *
24
+ * `reactVersion` defaults to `detect`. Under ESLint 10, eslint-plugin-react 7 cannot detect it and
25
+ * aborts, so pass the version there (`reactVersion: '19.2'`).
26
+ */
27
+ export declare class ReactEslintConfigs {
28
+ static create(opts: {
29
+ plugins: IReactEslintPlugins;
30
+ reactVersion?: string;
31
+ }): Linter.Config[];
32
+ }
33
+ /**
34
+ * The oxlint counterpart of `ReactEslintConfigs`: `oxlintConfigs` plus the React, hooks and
35
+ * accessibility rules, `consistent-type-imports`, and the secure-context ban. oxlint runs these
36
+ * plugins natively, so nothing is passed in. `react/no-deprecated` has no oxlint port and is left out.
37
+ *
38
+ * Nothing in the base is relaxed - frontend code meets the backend's standard - and
39
+ * `exhaustive-deps` is an error.
40
+ *
41
+ * ```ts
42
+ * // .configs/oxlint.config.mts
43
+ * import { defineConfig } from 'oxlint';
44
+ * import { ReactOxlintConfigs } from '@venizia/dev-configs/linters';
45
+ *
46
+ * export default defineConfig(ReactOxlintConfigs.create());
47
+ * ```
48
+ */
49
+ export declare class ReactOxlintConfigs {
50
+ static create(): OxlintConfig;
51
+ }
52
+ /**
53
+ * `namingConventionConfigs` for a React project: the base rule plus PascalCase functions in .jsx and
54
+ * .tsx files, where a component is declared as `function App()`.
55
+ */
56
+ export declare const reactNamingConventionConfigs: Linter.Config[];
57
+ export {};
58
+ //# sourceMappingURL=react.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/linters/react.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAM3C,sGAAsG;AACtG,KAAK,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAEnD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,YAAY,CAAC;IACpB,UAAU,EAAE,YAAY,CAAC;IACzB,OAAO,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,mBAAmB,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE;CA8D9F;AAQD;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,IAAI,YAAY;CAgD9B;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,MAAM,EAYvD,CAAC"}
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.reactNamingConventionConfigs = exports.ReactOxlintConfigs = exports.ReactEslintConfigs = void 0;
7
+ const typescript_eslint_1 = __importDefault(require("typescript-eslint"));
8
+ const eslint_1 = require("./eslint");
9
+ const oxlint_1 = require("./oxlint");
10
+ const rules_1 = require("./rules");
11
+ /**
12
+ * The base preset plus what a React frontend needs on top: the React, hooks and accessibility rules.
13
+ * Frontend code is held to the backend's standard - no floating promise, no `void`, no use before
14
+ * declaration - so nothing in the base is relaxed. The plugins come in as options, so a backend that
15
+ * never calls this installs none of them.
16
+ *
17
+ * ```js
18
+ * import react from 'eslint-plugin-react';
19
+ * import reactHooks from 'eslint-plugin-react-hooks';
20
+ * import jsxA11y from 'eslint-plugin-jsx-a11y';
21
+ *
22
+ * export default ReactEslintConfigs.create({ plugins: { react, reactHooks, jsxA11y } });
23
+ * ```
24
+ *
25
+ * `reactVersion` defaults to `detect`. Under ESLint 10, eslint-plugin-react 7 cannot detect it and
26
+ * aborts, so pass the version there (`reactVersion: '19.2'`).
27
+ */
28
+ class ReactEslintConfigs {
29
+ static create(opts) {
30
+ const { react, reactHooks, jsxA11y } = opts.plugins;
31
+ const { reactVersion = 'detect' } = opts;
32
+ return [
33
+ ...eslint_1.eslintConfigs,
34
+ {
35
+ files: ['**/*.{jsx,tsx}'],
36
+ plugins: { react, 'jsx-a11y': jsxA11y },
37
+ settings: { react: { version: reactVersion } },
38
+ rules: {
39
+ // The base naming rule, plus PascalCase functions: a component declared as `function App()`.
40
+ [rules_1.NamingConventionRule.NAME]: rules_1.NamingConventionRule.build({
41
+ extraSelectors: [{ selector: 'function', format: ['camelCase', 'PascalCase'] }],
42
+ }),
43
+ // Correctness rules from react's recommended set. Left out: what the automatic JSX runtime or
44
+ // tsc already covers (react-in-jsx-scope, jsx-uses-react, prop-types, jsx-no-undef,
45
+ // jsx-no-duplicate-props, no-unknown-property).
46
+ 'react/display-name': 'error',
47
+ 'react/jsx-boolean-value': 'error',
48
+ 'react/jsx-key': 'error',
49
+ 'react/jsx-no-comment-textnodes': 'error',
50
+ 'react/jsx-no-target-blank': 'error',
51
+ 'react/no-children-prop': 'error',
52
+ 'react/no-danger-with-children': 'error',
53
+ 'react/no-deprecated': 'error',
54
+ 'react/no-direct-mutation-state': 'error',
55
+ 'react/no-find-dom-node': 'error',
56
+ 'react/no-is-mounted': 'error',
57
+ 'react/no-render-return-value': 'error',
58
+ 'react/no-string-refs': 'error',
59
+ 'react/require-render-return': 'error',
60
+ 'jsx-a11y/alt-text': 'error',
61
+ 'jsx-a11y/anchor-has-content': 'error',
62
+ 'jsx-a11y/aria-props': 'error',
63
+ 'jsx-a11y/aria-proptypes': 'error',
64
+ 'jsx-a11y/aria-role': 'error',
65
+ 'jsx-a11y/aria-unsupported-elements': 'error',
66
+ 'jsx-a11y/role-has-required-aria-props': 'error',
67
+ 'jsx-a11y/role-supports-aria-props': 'error',
68
+ 'jsx-a11y/tabindex-no-positive': 'error',
69
+ },
70
+ },
71
+ {
72
+ // Custom hooks live in .ts files too.
73
+ files: ['**/*.{js,jsx,ts,tsx}'],
74
+ plugins: { 'react-hooks': reactHooks },
75
+ rules: {
76
+ 'react-hooks/rules-of-hooks': 'error',
77
+ 'react-hooks/exhaustive-deps': 'error',
78
+ },
79
+ },
80
+ {
81
+ rules: {
82
+ '@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
83
+ [rules_1.NoRestrictedPropertiesRule.NAME]: rules_1.NoRestrictedPropertiesRule.build(),
84
+ },
85
+ },
86
+ ];
87
+ }
88
+ }
89
+ exports.ReactEslintConfigs = ReactEslintConfigs;
90
+ const JSX_FILES = ['**/*.jsx', '**/*.tsx'];
91
+ const SOURCE_FILES = ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'];
92
+ /** A component is declared as `function App()`, so functions may be PascalCase too. */
93
+ const COMPONENT_FUNCTION_SELECTOR = { selector: 'function', format: ['camelCase', 'PascalCase'] };
94
+ /**
95
+ * The oxlint counterpart of `ReactEslintConfigs`: `oxlintConfigs` plus the React, hooks and
96
+ * accessibility rules, `consistent-type-imports`, and the secure-context ban. oxlint runs these
97
+ * plugins natively, so nothing is passed in. `react/no-deprecated` has no oxlint port and is left out.
98
+ *
99
+ * Nothing in the base is relaxed - frontend code meets the backend's standard - and
100
+ * `exhaustive-deps` is an error.
101
+ *
102
+ * ```ts
103
+ * // .configs/oxlint.config.mts
104
+ * import { defineConfig } from 'oxlint';
105
+ * import { ReactOxlintConfigs } from '@venizia/dev-configs/linters';
106
+ *
107
+ * export default defineConfig(ReactOxlintConfigs.create());
108
+ * ```
109
+ */
110
+ class ReactOxlintConfigs {
111
+ static create() {
112
+ return {
113
+ ...oxlint_1.oxlintConfigs,
114
+ plugins: [...new Set([...(oxlint_1.oxlintConfigs.plugins ?? []), 'react', 'jsx-a11y'])],
115
+ overrides: [
116
+ ...(oxlint_1.oxlintConfigs.overrides ?? []),
117
+ {
118
+ files: JSX_FILES,
119
+ rules: {
120
+ // Correctness rules from react's recommended set, as in ReactEslintConfigs.
121
+ 'react/display-name': 'error',
122
+ 'react/jsx-boolean-value': 'error',
123
+ 'react/jsx-key': 'error',
124
+ 'react/jsx-no-comment-textnodes': 'error',
125
+ 'react/jsx-no-target-blank': 'error',
126
+ 'react/no-children-prop': 'error',
127
+ 'react/no-danger-with-children': 'error',
128
+ 'react/no-direct-mutation-state': 'error',
129
+ 'react/no-find-dom-node': 'error',
130
+ 'react/no-is-mounted': 'error',
131
+ 'react/no-render-return-value': 'error',
132
+ 'react/no-string-refs': 'error',
133
+ 'react/require-render-return': 'error',
134
+ 'jsx-a11y/alt-text': 'error',
135
+ 'jsx-a11y/anchor-has-content': 'error',
136
+ 'jsx-a11y/aria-props': 'error',
137
+ 'jsx-a11y/aria-proptypes': 'error',
138
+ 'jsx-a11y/aria-role': 'error',
139
+ 'jsx-a11y/aria-unsupported-elements': 'error',
140
+ 'jsx-a11y/role-has-required-aria-props': 'error',
141
+ 'jsx-a11y/role-supports-aria-props': 'error',
142
+ 'jsx-a11y/tabindex-no-positive': 'error',
143
+ },
144
+ },
145
+ {
146
+ // Custom hooks live in .ts files too.
147
+ files: SOURCE_FILES,
148
+ rules: {
149
+ 'react/rules-of-hooks': 'error',
150
+ 'react/exhaustive-deps': 'error',
151
+ 'typescript/consistent-type-imports': ['error', { prefer: 'type-imports' }],
152
+ [rules_1.NoRestrictedPropertiesRule.NAME]: rules_1.NoRestrictedPropertiesRule.build(),
153
+ },
154
+ },
155
+ ],
156
+ };
157
+ }
158
+ }
159
+ exports.ReactOxlintConfigs = ReactOxlintConfigs;
160
+ /**
161
+ * `namingConventionConfigs` for a React project: the base rule plus PascalCase functions in .jsx and
162
+ * .tsx files, where a component is declared as `function App()`.
163
+ */
164
+ exports.reactNamingConventionConfigs = [
165
+ ...eslint_1.namingConventionConfigs,
166
+ {
167
+ files: JSX_FILES,
168
+ languageOptions: { parser: typescript_eslint_1.default.parser },
169
+ plugins: { '@typescript-eslint': typescript_eslint_1.default.plugin },
170
+ rules: {
171
+ [rules_1.NamingConventionRule.NAME]: rules_1.NamingConventionRule.build({
172
+ extraSelectors: [COMPONENT_FUNCTION_SELECTOR],
173
+ }),
174
+ },
175
+ },
176
+ ];
177
+ //# sourceMappingURL=react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/linters/react.ts"],"names":[],"mappings":";;;;;;AAEA,0EAAyC;AACzC,qCAAkE;AAClE,qCAAyC;AACzC,mCAA2E;AAW3E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CAAC,IAA6D;QACzE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QACpD,MAAM,EAAE,YAAY,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC;QAEzC,OAAO;YACL,GAAG,sBAAa;YAChB;gBACE,KAAK,EAAE,CAAC,gBAAgB,CAAC;gBACzB,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE;gBACvC,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,YAAY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