@4mbl/lint 0.0.0-beta.2a064a7 → 0.0.0-beta.2b77e08

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/CHANGELOG.md CHANGED
@@ -1,5 +1,140 @@
1
1
  # @4mbl/lint
2
2
 
3
+ ## 1.0.0-beta.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 2c338b1: fix(lint): re-export `OxlintConfig` to make config portable
8
+
9
+ ## 1.0.0-beta.0
10
+
11
+ ### Major Changes
12
+
13
+ - c65e34e: Add CLI to allow default arguments and easier tool migration in the future
14
+ - c65e34e: Migrate from eslint to oxlint
15
+
16
+ ## 0.16.0
17
+
18
+ ### Minor Changes
19
+
20
+ - 6878a35: Upgrade config dependencies
21
+
22
+ ## 0.15.0
23
+
24
+ ### Minor Changes
25
+
26
+ - 5040323: Upgrade config dependencies
27
+
28
+ ## 0.14.0
29
+
30
+ ### Minor Changes
31
+
32
+ - 794dbfb: Upgrade config dependencies
33
+ - e6a08fd: Upgrade to ESLint 10
34
+
35
+ ## 0.13.0
36
+
37
+ ### Minor Changes
38
+
39
+ - ac23f1d: Upgrade config dependencies
40
+
41
+ ## 0.12.0
42
+
43
+ ### Minor Changes
44
+
45
+ - dd16619: Upgrade config dependencies
46
+
47
+ ## 0.11.0
48
+
49
+ ### Minor Changes
50
+
51
+ - e011cd6: Upgrade config dependencies
52
+
53
+ ## 0.10.0
54
+
55
+ ### Minor Changes
56
+
57
+ - 774cb2a: Upgrade config dependencies
58
+
59
+ ## 0.9.0
60
+
61
+ ### Minor Changes
62
+
63
+ - aee78b7: Upgrade config dependencies
64
+
65
+ ## 0.8.0
66
+
67
+ ### Minor Changes
68
+
69
+ - 152396b: Upgrade config dependencies
70
+
71
+ ## 0.7.0
72
+
73
+ ### Minor Changes
74
+
75
+ - 8e46d6b: Upgrade config dependencies
76
+
77
+ ### Patch Changes
78
+
79
+ - 8e46d6b: Re-export types with type-keyword to fix verbatimModuleSyntax
80
+
81
+ ## 0.6.0
82
+
83
+ ### Minor Changes
84
+
85
+ - 46d0443: Upgrade config dependencies
86
+
87
+ ## 0.5.0
88
+
89
+ ### Minor Changes
90
+
91
+ - 55c3db6: Export `defineConfig` from eslint
92
+ - f7d30bb: Upgrade config dependencies
93
+
94
+ ## 0.4.0
95
+
96
+ ### Minor Changes
97
+
98
+ - 00cfefd: Add node template
99
+
100
+ ## 0.3.2
101
+
102
+ ### Patch Changes
103
+
104
+ - df1c48b: Re-export eslint Config type from react template
105
+
106
+ ## 0.3.1
107
+
108
+ ### Patch Changes
109
+
110
+ - d17fc69: Fix react template export
111
+
112
+ ## 0.3.0
113
+
114
+ ### Minor Changes
115
+
116
+ - 6d969e6: Add react template
117
+ - 6d969e6: Upgrade eslint and config dependencies
118
+
119
+ ## 0.2.1
120
+
121
+ ### Patch Changes
122
+
123
+ - 3a223fe: Use flat config version of eslint-plugin-react-hooks
124
+
125
+ ## 0.2.0
126
+
127
+ ### Minor Changes
128
+
129
+ - c4e49f3: Add eslint-plugin-react-hooks
130
+ - c4e49f3: Add eslint-config-prettier
131
+
132
+ ## 0.1.1
133
+
134
+ ### Patch Changes
135
+
136
+ - 2c91355: Move dependencies not to be dev-only
137
+
3
138
  ## 0.1.0
4
139
 
5
140
  ### Minor Changes
package/README.md CHANGED
@@ -2,40 +2,77 @@
2
2
 
3
3
  > Linting configuration for various environments.
4
4
 
5
- * [Usage](#usage)
6
- * [Available templates](#available-templates)
7
- * [Versioning](#versioning)
5
+ - [Usage](#usage)
6
+ - [Running `lint` CLI wrapper](#running-lint-cli-wrapper)
7
+ - [Running `oxlint` directly](#running-oxlint-directly)
8
+ - [Available templates](#available-templates)
9
+ - [Versioning](#versioning)
8
10
 
9
11
  ---
10
12
 
13
+ > [!NOTE]
14
+ > This package currently uses [oxlint](https://www.npmjs.com/package/oxlint) as the underlying linting tool. That may change in a future major release.
15
+
11
16
  ## Usage
12
17
 
13
- Install the [`@4mbl/lint`](https://www.npmjs.com/package/@4mbl/lint) npm package.
18
+ Install the [`@4mbl/lint`](https://www.npmjs.com/package/@4mbl/lint) package.
14
19
 
15
20
  ```shell
16
21
  npm install -D @4mbl/lint
17
22
  ```
18
23
 
19
- Create a `eslint.config.ts` file in the root of your project with the desired configuration. This package currently uses eslint. That might change in a future major release.
24
+ Create a `oxlint.config.ts` file for your package. If you are using a monorepo, create a `oxlint.config.ts` for each package in the monorepo.
20
25
 
21
26
  ```js
22
- import defaultConfig, { type Config } from '@4mbl/lint/next'; // <-- change `next` to the desired template
27
+ import defineConfig from '@4mbl/lint/next'; // <-- change `next` to the desired template
28
+
29
+ export default defineConfig();
30
+ ```
31
+
32
+ ### Running `lint` CLI wrapper
33
+
34
+ This is the recommended way as it abstracts away the underlying linting package and allows us to change it in the future. While we try to keep the CLI wrapper interface stable between possible tooling changes, it is inevitable to have breaking changes if the underlying tooling changes.
23
35
 
24
- export default [...defaultConfig] satisfies Config[];
36
+ Set a script that uses the linting CLI wrapper in your `package.json`. While it may be tempting to just call `lint` directly in CI or locally, it is recommended to use a script as it allows additional arguments to be passed to the CLI wrapper.
37
+
38
+ ```shell
39
+ npm pkg set scripts.lint="lint"
40
+ ```
41
+
42
+ The CLI wrapper uses the `src` directory by default and the following arguments:
43
+
44
+ - `--max-warnings=0`
45
+ - `--report-unused-disable-directives`
46
+
47
+ These arguments can be overridden by passing them explicitly to the CLI wrapper.
48
+
49
+ ### Running `oxlint` directly
50
+
51
+ ```shell
52
+ npm pkg set scripts.lint="oxlint src"
53
+ ```
54
+
55
+ You may need to explicitly allow the underlying linting packages to be used by your scripts.
56
+
57
+ For example, when using pnpm, you need to set `publicHoistPattern` in your `pnpm-workspace.yaml`.
58
+
59
+ ```yaml
60
+ publicHoistPattern:
61
+ - oxlint
25
62
  ```
26
63
 
27
64
  ## Available templates
28
65
 
29
- There is currently one config template.
66
+ These are the currently available config templates.
30
67
 
31
- - **Next** - Linting configuration extending the Next.js default config.
68
+ - **Next** - Extending the Next.js linting config.
69
+ - **Node** - Linting configuration for Node.js.
70
+ - **React** - Extending the Vite-React linting config.
32
71
 
33
72
  ## Versioning
34
73
 
35
- As of version 4.0.0, the package migrated to a single template per type. The package version is now used to determine the template version. This simplifies both the maintenance and usage of the package.
36
-
37
- The package follows the following versioning scheme: `X.Y.Z`
74
+ The package follows the following versioning scheme: `X.Y.Z`.
38
75
 
39
- - `X` - Reserved for linting provider changes as those might cause wider backwards compat issues.
76
+ - `X` - Reserved for linting provider changes as those might cause wider backwards compatibility issues.
40
77
  - `Y` - New linting rules. New rules are first added as warnings, and if error is preferred, the rule is promoted to produce errors in the next minor release.
41
78
  - `Z` - Minor fixes that make the previous release unusable.
package/bin/cli.js ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawnSync } from 'node:child_process';
4
+
5
+ const args = process.argv.slice(2);
6
+
7
+ const hasPath = args.some((a) => !a.startsWith('-'));
8
+ const hasMaxWarn = args.some((a) => a.startsWith('--max-warnings'));
9
+ const hasReportUnused = args.some((a) =>
10
+ a.startsWith('--report-unused-disable-directives'),
11
+ );
12
+
13
+ const finalArgs = [
14
+ ...(hasPath ? [] : ['src']),
15
+ ...(hasMaxWarn ? [] : ['--max-warnings=0']),
16
+ ...(hasReportUnused ? [] : ['--report-unused-disable-directives']),
17
+ ...args,
18
+ ];
19
+
20
+ const result = spawnSync('oxlint', finalArgs, {
21
+ stdio: 'inherit',
22
+ shell: true,
23
+ });
24
+
25
+ process.exit(result.status ?? 1);
package/package.json CHANGED
@@ -1,16 +1,23 @@
1
1
  {
2
2
  "name": "@4mbl/lint",
3
- "version": "0.0.0-beta.2a064a7",
3
+ "version": "0.0.0-beta.2b77e08",
4
4
  "description": "Linting configuration for various environments.",
5
5
  "type": "module",
6
6
  "author": "4mbl",
7
7
  "license": "MIT",
8
8
  "homepage": "https://github.com/4mbl/config/tree/main/packages/lint#readme",
9
9
  "exports": {
10
- "./next": "./src/next.ts"
10
+ "./*": {
11
+ "types": "./dist/*.d.ts",
12
+ "development": "./src/*.ts",
13
+ "default": "./dist/*.js"
14
+ }
15
+ },
16
+ "bin": {
17
+ "lint": "./bin/cli.js"
11
18
  },
12
19
  "files": [
13
- "src",
20
+ "dist",
14
21
  "package.json",
15
22
  "README.md",
16
23
  "CHANGELOG.md"
@@ -24,12 +31,18 @@
24
31
  "lint"
25
32
  ],
26
33
  "dependencies": {
27
- "@eslint/js": "^9.38.0",
28
- "eslint": "^9.38.0",
29
- "eslint-config-next": "^16.0.1",
30
34
  "eslint-plugin-react-compiler": "19.1.0-rc.2",
35
+ "eslint-plugin-react-hooks": "^7.0.1",
36
+ "eslint-plugin-react-refresh": "^0.5.2",
37
+ "globals": "^17.4.0",
31
38
  "jiti": "^2.6.1",
32
- "typescript-eslint": "^8.46.2"
39
+ "oxlint": "^1.56.0",
40
+ "oxlint-tsgolint": "^0.17.0"
41
+ },
42
+ "devDependencies": {
43
+ "@4mbl/tsconfig": "0.0.0-beta.2b77e08"
33
44
  },
34
- "scripts": {}
45
+ "scripts": {
46
+ "build": "tsc"
47
+ }
35
48
  }
package/src/next.ts DELETED
@@ -1,30 +0,0 @@
1
- // @ts-nocheck
2
- import js from '@eslint/js';
3
- import nextVitals from 'eslint-config-next/core-web-vitals';
4
- import nextTs from 'eslint-config-next/typescript';
5
- import * as reactCompiler from 'eslint-plugin-react-compiler';
6
- import { defineConfig, globalIgnores, Config } from 'eslint/config';
7
- import tseslint from 'typescript-eslint';
8
-
9
- export { Config };
10
-
11
- export default defineConfig([
12
- js.configs.recommended,
13
- ...tseslint.configs.recommended,
14
- {
15
- languageOptions: {
16
- parserOptions: {
17
- tsconfigRootDir: (import.meta as any).dirname,
18
- },
19
- },
20
- },
21
- ...nextVitals,
22
- ...nextTs,
23
- globalIgnores(['.next/**', 'out/**', 'build/**', 'next-env.d.ts']),
24
- reactCompiler.configs.recommended,
25
- {
26
- rules: {
27
- 'react-compiler/react-compiler': 'error',
28
- },
29
- },
30
- ]) satisfies Config[];