@jandragsbaek/oxlint-plugin 0.0.0-stage → 0.2.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.
@@ -0,0 +1,16 @@
1
+ import { OxlintConfig } from "oxlint";
2
+ export declare const TEST_FILES: string[];
3
+ interface FileScope {
4
+ readonly files: ReadonlyArray<string>;
5
+ readonly excludeFiles?: ReadonlyArray<string>;
6
+ }
7
+ export declare const recommended: OxlintConfig;
8
+ export declare const tests: OxlintConfig;
9
+ export declare const effect: OxlintConfig;
10
+ export declare const react: OxlintConfig;
11
+ export declare const reactCompiler: (scope: FileScope) => OxlintConfig;
12
+ export declare const productCopy: (scope: FileScope) => OxlintConfig;
13
+ export declare const uiText: (scope: FileScope & {
14
+ readonly message?: string;
15
+ }) => OxlintConfig;
16
+ export {};
@@ -0,0 +1,132 @@
1
+ import * as NodePath from "node:path";
2
+ import * as NodeURL from "node:url";
3
+ // src/presets.ts
4
+ const here = NodeURL.fileURLToPath(import.meta.url);
5
+ const siblingIndexTsInSourceOrIndexMjsOnceBuilt = `index${NodePath.extname(here)}`;
6
+ const jsPlugins = [NodePath.join(NodePath.dirname(here), siblingIndexTsInSourceOrIndexMjsOnceBuilt)];
7
+ const TEST_FILES = ["**/*.{test,spec,testkit}.{ts,tsx,js,jsx,mts,cts,mjs,cjs}", "**/{test,tests,__tests__,testkit,testing,fixtures,integration}/**"];
8
+ const scoped = (scope, rules, testFiles = "skip") => {
9
+ const excludeFiles = [...testFiles === "skip" ? TEST_FILES : [], ...scope.excludeFiles ?? []];
10
+ return {
11
+ files: [...scope.files],
12
+ ...excludeFiles.length > 0 ? { excludeFiles } : {},
13
+ rules
14
+ };
15
+ };
16
+ const recommended = {
17
+ plugins: [
18
+ "eslint",
19
+ "oxc",
20
+ "unicorn",
21
+ "typescript"
22
+ ],
23
+ jsPlugins,
24
+ categories: {
25
+ correctness: "warn",
26
+ suspicious: "warn",
27
+ perf: "warn"
28
+ },
29
+ rules: {
30
+ "eslint/no-await-in-loop": "off",
31
+ "eslint/no-control-regex": "off",
32
+ "eslint/no-empty-pattern": "error",
33
+ "eslint/no-new": "error",
34
+ "eslint/no-shadow": "off",
35
+ "eslint/no-underscore-dangle": "off",
36
+ "eslint/no-unneeded-ternary": "error",
37
+ "eslint/no-unsafe-optional-chaining": "error",
38
+ "eslint/no-unused-vars": ["error", {
39
+ argsIgnorePattern: "^_",
40
+ varsIgnorePattern: "^_",
41
+ caughtErrorsIgnorePattern: "^_"
42
+ }],
43
+ "oxc/no-accumulating-spread": "error",
44
+ "oxc/no-map-spread": "off",
45
+ "typescript/no-extraneous-class": "error",
46
+ "typescript/no-this-alias": "off",
47
+ "unicorn/consistent-function-scoping": "off",
48
+ "unicorn/no-array-reverse": "off",
49
+ "unicorn/no-array-sort": "off",
50
+ "unicorn/no-new-array": "off",
51
+ "unicorn/no-useless-fallback-in-spread": "error",
52
+ "unicorn/no-useless-spread": "error",
53
+ "unicorn/prefer-add-event-listener": "off",
54
+ "unicorn/prefer-array-find": "off",
55
+ "unicorn/prefer-set-has": "off",
56
+ "unicorn/prefer-string-starts-ends-with": "off",
57
+ "unicorn/require-module-specifiers": "error",
58
+ "jandragsbaek/max-file-lines": "error",
59
+ "jandragsbaek/max-file-lines-hard": "error",
60
+ "jandragsbaek/namespace-node-imports": "error",
61
+ "jandragsbaek/no-explanatory-comments": "error",
62
+ "jandragsbaek/no-unscoped-has": "error",
63
+ "jandragsbaek/require-suppression-reason": "error"
64
+ },
65
+ options: { reportUnusedDisableDirectives: "error" }
66
+ };
67
+ const tests = {
68
+ jsPlugins,
69
+ rules: {
70
+ "jandragsbaek/no-dom-test-environment": "error",
71
+ "jandragsbaek/no-polling-loop-in-tests": "error",
72
+ "jandragsbaek/no-real-time-wait-in-tests": "error",
73
+ "jandragsbaek/no-test-in-loop": "error",
74
+ "jandragsbaek/no-test-timeout-or-unreasoned-skip": "error",
75
+ "jandragsbaek/no-wall-clock-in-tests": "error"
76
+ }
77
+ };
78
+ const effect = {
79
+ jsPlugins,
80
+ rules: {
81
+ "jandragsbaek/no-inline-schema-compile": "error",
82
+ "jandragsbaek/no-manual-effect-runtime-in-tests": "error",
83
+ "jandragsbaek/prefer-catch-tags": "error",
84
+ "jandragsbaek/prefer-effect-fn": "error"
85
+ },
86
+ overrides: [{
87
+ files: TEST_FILES,
88
+ rules: { "jandragsbaek/prefer-effect-fn": "off" }
89
+ }]
90
+ };
91
+ const react = {
92
+ plugins: ["react"],
93
+ jsPlugins,
94
+ rules: {
95
+ "react-hooks/exhaustive-deps": "off",
96
+ "react-in-jsx-scope": "off",
97
+ "react/capitalized-calls": "error",
98
+ "react/exhaustive-effect-dependencies": "error",
99
+ "react/immutability": "error",
100
+ "react/memo-dependencies": "error",
101
+ "react/no-array-index-key": "error",
102
+ "react/no-object-type-as-default-prop": "off",
103
+ "react/no-unstable-nested-components": "error",
104
+ "react/purity": "error",
105
+ "react/refs": "error",
106
+ "react/set-state-in-effect": "error",
107
+ "react/static-components": "error",
108
+ "jandragsbaek/no-unreasoned-state-sync": "error"
109
+ }
110
+ };
111
+ const compilerMemoizesContextValues = { "react/jsx-no-constructed-context-values": "off" };
112
+ const reactCompiler = (scope) => ({
113
+ jsPlugins,
114
+ overrides: [scoped(scope, {
115
+ "react/globals": "error",
116
+ "react/hooks": "error",
117
+ ...compilerMemoizesContextValues,
118
+ "react/preserve-manual-memoization": "error",
119
+ "react/set-state-in-render": "error",
120
+ "react/unsupported-syntax": "error",
121
+ "jandragsbaek/no-manual-memo": "error"
122
+ }, "check"), scoped(scope, { "jandragsbaek/no-hookless-use-function": "error" })]
123
+ });
124
+ const productCopy = (scope) => ({
125
+ jsPlugins,
126
+ overrides: [scoped(scope, { "jandragsbaek/no-em-dash-copy": "error" })]
127
+ });
128
+ const uiText = (scope) => ({
129
+ jsPlugins,
130
+ overrides: [scoped(scope, { "jandragsbaek/no-untranslated-ui-text": scope.message === void 0 ? "error" : ["error", { message: scope.message }] })]
131
+ });
132
+ export { TEST_FILES, effect, productCopy, react, reactCompiler, recommended, tests, uiText };
package/package.json CHANGED
@@ -1,6 +1,70 @@
1
1
  {
2
2
  "name": "@jandragsbaek/oxlint-plugin",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "description": "Oxlint rules and presets for tests, Effect, React and product copy.",
5
+ "keywords": [
6
+ "effect",
7
+ "lint",
8
+ "oxlint",
9
+ "oxlint-plugin",
10
+ "react",
11
+ "react-compiler",
12
+ "vitest"
13
+ ],
14
+ "homepage": "https://github.com/jandragsbaek/oxlint-plugin#readme",
15
+ "bugs": "https://github.com/jandragsbaek/oxlint-plugin/issues",
16
+ "license": "MIT",
17
+ "author": "Jan Dragsbaek <jan@dragsbaek.tech>",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/jandragsbaek/oxlint-plugin.git"
21
+ },
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "type": "module",
26
+ "exports": {
27
+ ".": "./dist/index.mjs",
28
+ "./presets": "./dist/presets.mjs",
29
+ "./package.json": "./package.json"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "provenance": true
34
+ },
35
+ "scripts": {
36
+ "prepare": "vp config --no-agent",
37
+ "build": "vp pack",
38
+ "typecheck": "tsc --noEmit",
39
+ "test": "vp test run",
40
+ "lint": "vp lint --report-unused-disable-directives",
41
+ "fmt": "vp fmt",
42
+ "fmt:check": "vp fmt --check",
43
+ "check": "vp fmt --check && vp lint --report-unused-disable-directives && tsc --noEmit && vp test run && vp pack",
44
+ "prepublishOnly": "vp pack"
45
+ },
46
+ "devDependencies": {
47
+ "@effect/platform-node": "4.1.2",
48
+ "@effect/vitest": "4.1.2",
49
+ "@oxlint/plugins": "^1.94.0",
50
+ "@types/node": "^24.19.2",
51
+ "effect": "4.1.2",
52
+ "oxlint": "1.91.0",
53
+ "publint": "^0.3.25",
54
+ "typescript": "^7.0.2",
55
+ "vite-plus": "1.5.1",
56
+ "yaml": "^2.9.1"
57
+ },
58
+ "peerDependencies": {
59
+ "oxlint": ">=1.91.0"
60
+ },
61
+ "peerDependenciesMeta": {
62
+ "oxlint": {
63
+ "optional": true
64
+ }
65
+ },
66
+ "engines": {
67
+ "node": "^20.19.0 || >=22.12.0"
68
+ },
69
+ "packageManager": "pnpm@12.16.1"
70
+ }