@paratco/eslint-config 3.4.0 → 4.0.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 +5 -63
- package/dist/configs/base.d.ts +3 -0
- package/dist/configs/import.d.ts +3 -0
- package/dist/configs/node.d.ts +1 -0
- package/dist/configs/prettierFormatter.d.ts +3 -0
- package/dist/configs/react.d.ts +3 -0
- package/dist/configs/stylisticFormatter.d.ts +3 -0
- package/dist/index.d.ts +3 -21
- package/dist/index.js +809 -0
- package/dist/index.js.map +22 -0
- package/dist/rules/import.d.ts +57 -0
- package/dist/rules/javascript.d.ts +22 -0
- package/dist/rules/react.d.ts +31 -0
- package/dist/rules/react_kit.d.ts +3 -0
- package/dist/rules/stylistic.d.ts +202 -0
- package/dist/rules/typescript.d.ts +96 -0
- package/dist/rules/unicorn.d.ts +34 -0
- package/dist/types.d.ts +14 -0
- package/package.json +28 -27
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs +0 -2
- package/dist/index.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -16,6 +16,11 @@ Yarn:
|
|
|
16
16
|
# prettier is optional, just use it if you want to use prettier formatting
|
|
17
17
|
yarn add -D @paratco/eslint-config eslint prettier
|
|
18
18
|
```
|
|
19
|
+
Bun:
|
|
20
|
+
```bash
|
|
21
|
+
# prettier is optional, just use it if you want to use prettier formatting
|
|
22
|
+
bun add -d @paratco/eslint-config eslint prettier
|
|
23
|
+
```
|
|
19
24
|
## Usage (ESLint Flat Config)
|
|
20
25
|
Create an `eslint.config.{js,mjs,ts}` file in your project root:
|
|
21
26
|
```javascript
|
|
@@ -124,68 +129,5 @@ export default [
|
|
|
124
129
|
];
|
|
125
130
|
```
|
|
126
131
|
> **Note:** When `files` is used and multiple `createConfig` calls are combined, spread each result (`...createConfig(...)`) into the top-level array instead of returning a single `createConfig` call directly.
|
|
127
|
-
## Using oxlint alongside ESLint
|
|
128
|
-
[oxlint](https://oxc-project.github.io/) is a fast JavaScript/TypeScript linter written in Rust that can be used alongside ESLint to improve performance and catch additional issues. This package supports using both linters together.
|
|
129
|
-
### Installation
|
|
130
|
-
Install oxlint alongside ESLint:
|
|
131
|
-
NPM:
|
|
132
|
-
```bash
|
|
133
|
-
npm install --save-dev --save-exact oxlint@1.7.0 eslint-plugin-oxlint@1.7.0
|
|
134
|
-
```
|
|
135
|
-
Yarn:
|
|
136
|
-
```bash
|
|
137
|
-
yarn add -D -E oxlint@1.7.0 eslint-plugin-oxlint@1.7.0
|
|
138
|
-
```
|
|
139
|
-
note: Ensure you have the latest and exact version of oxlint and eslint-plugin-oxlint installed.
|
|
140
|
-
### Configuration
|
|
141
|
-
1. Create an `.oxlintrc.json` file with @oxlint/migrate:
|
|
142
|
-
```bash
|
|
143
|
-
# version match with oxlint installed before
|
|
144
|
-
npx @oxlint/migrate@1.7.0
|
|
145
|
-
```
|
|
146
|
-
This will generate or update your `.oxlintrc.json` file based on your ESLint configuration. The tool analyzes your ESLint config and converts compatible rules to their oxlint equivalents.
|
|
147
|
-
2. Update your `package.json` scripts to run both linters (run oxlint first for performance):
|
|
148
|
-
```json
|
|
149
|
-
{
|
|
150
|
-
"scripts": {
|
|
151
|
-
"lint": "oxlint --max-warnings=0 && eslint --max-warnings=0",
|
|
152
|
-
"lint:fix": "oxlint --fix && eslint --fix"
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
```
|
|
156
|
-
3. integrate oxlint with ESLint by adding the ESLint plugin to your configuration:
|
|
157
|
-
```javascript
|
|
158
|
-
import { createConfig } from "@paratco/eslint-config";
|
|
159
|
-
import oxlintPlugin from "eslint-plugin-oxlint";
|
|
160
|
-
export default createConfig({
|
|
161
|
-
platform: "node", // or "react"
|
|
162
|
-
style: "prettier", // or "stylistic"
|
|
163
|
-
// Add oxlint plugin as the LAST item in your overrides
|
|
164
|
-
// This ensures ESLint rules that are handled by oxlint are turned off
|
|
165
|
-
overrides: [
|
|
166
|
-
// Your other overrides go here
|
|
167
|
-
// eslint-plugin-oxlint must be the last config
|
|
168
|
-
...oxlintPlugin.configs["flat/all"]
|
|
169
|
-
]
|
|
170
|
-
});
|
|
171
|
-
```
|
|
172
|
-
### Running Linters
|
|
173
|
-
Run both linters with a single command:
|
|
174
|
-
```bash
|
|
175
|
-
npm run lint
|
|
176
|
-
# or
|
|
177
|
-
yarn lint
|
|
178
|
-
```
|
|
179
|
-
Fix issues automatically when possible:
|
|
180
|
-
```bash
|
|
181
|
-
npm run lint:fix
|
|
182
|
-
# or
|
|
183
|
-
yarn lint:fix
|
|
184
|
-
```
|
|
185
|
-
### Benefits of Using Both Linters
|
|
186
|
-
- **Performance**: oxlint is significantly faster than ESLint, especially on large codebases
|
|
187
|
-
- **Complementary Rules**: Each linter has unique rules that can catch different issues
|
|
188
|
-
- **Gradual Migration**: You can gradually migrate from ESLint to oxlint or use both permanently
|
|
189
|
-
- **Modern JavaScript Support**: oxlint has excellent support for modern JavaScript and TypeScript features
|
|
190
132
|
## License
|
|
191
133
|
Licensed under [MIT License](./LICENSE)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./base";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
import { Linter } from "eslint";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
interface TypescriptOptions {
|
|
5
|
-
tsconfigRootDir?: string;
|
|
6
|
-
project?: string | string[];
|
|
7
|
-
}
|
|
8
|
-
interface Options {
|
|
9
|
-
platform: "node" | "react";
|
|
10
|
-
style: "stylistic" | "prettier";
|
|
11
|
-
useImport?: boolean;
|
|
12
|
-
files?: string[];
|
|
13
|
-
overrides?: Linter.Config[];
|
|
14
|
-
ignores?: string[];
|
|
15
|
-
typescript?: TypescriptOptions;
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/index.d.ts
|
|
19
|
-
declare function createConfig(opt: Options): Linter.Config[];
|
|
20
|
-
//#endregion
|
|
21
|
-
export { createConfig };
|
|
1
|
+
import type { Linter } from "eslint";
|
|
2
|
+
import type { Options } from "./types";
|
|
3
|
+
export declare function createConfig(opt: Options): Linter.Config[];
|