@plumeria/eslint-plugin 2.1.2 → 2.2.1
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 +14 -8
- package/bin/oxlint.js +28 -0
- package/oxlint-plugin.js +6 -0
- package/oxlint.json +13 -0
- package/package.json +13 -3
- package/bin/plumerialint.js +0 -30
package/README.md
CHANGED
|
@@ -43,20 +43,24 @@ Validates CSS property values for correctness. Only standard CSS properties are
|
|
|
43
43
|
|
|
44
44
|
## CLI (plumerialint)
|
|
45
45
|
|
|
46
|
-
This package
|
|
47
|
-
to run
|
|
46
|
+
This package provides a CLI command, `plumerialint`, as a convenient way
|
|
47
|
+
to run Plumeria's custom ESLint rules.
|
|
48
48
|
|
|
49
|
-
It uses
|
|
50
|
-
|
|
49
|
+
It uses `oxlint` internally for fast linting with code snippets in output.
|
|
50
|
+
|
|
51
|
+
### Installation
|
|
51
52
|
|
|
52
53
|
```bash
|
|
53
|
-
|
|
54
|
+
npm install -D @plumeria/eslint-plugin oxlint
|
|
55
|
+
# or
|
|
56
|
+
pnpm add -D @plumeria/eslint-plugin oxlint
|
|
54
57
|
```
|
|
55
58
|
|
|
56
|
-
|
|
59
|
+
### Usage
|
|
57
60
|
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
```bash
|
|
62
|
+
plumerialint
|
|
63
|
+
```
|
|
60
64
|
|
|
61
65
|
The process exits with a non-zero status code if any errors or warnings are found,
|
|
62
66
|
making it suitable for use in CI and build pipelines.
|
|
@@ -70,3 +74,5 @@ Example usage in `package.json`:
|
|
|
70
74
|
}
|
|
71
75
|
}
|
|
72
76
|
```
|
|
77
|
+
|
|
78
|
+
**Note:** `oxlint` is required as `plumerialint` uses it internally.
|
package/bin/oxlint.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const process = require('process');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const oxlint = path.join(__dirname, '..', 'oxlint.json');
|
|
7
|
+
|
|
8
|
+
const args = ['-c', oxlint, '--deny-warnings', ...process.argv.slice(2)];
|
|
9
|
+
|
|
10
|
+
const child = spawn('oxlint', args, {
|
|
11
|
+
stdio: 'inherit',
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
child.on('error', (err) => {
|
|
15
|
+
if (err.code === 'ENOENT') {
|
|
16
|
+
console.error('\n✖ oxlint is not installed.');
|
|
17
|
+
console.error('➡︎ plumerialint uses oxlint.');
|
|
18
|
+
console.error('✔ please install oxlint.\n');
|
|
19
|
+
process.exit(1);
|
|
20
|
+
} else {
|
|
21
|
+
console.error('Error running oxlint:', err.message);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
child.on('close', (code) => {
|
|
27
|
+
process.exit(code || 0);
|
|
28
|
+
});
|
package/oxlint-plugin.js
ADDED
package/oxlint.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"jsPlugins": ["./oxlint-plugin.js"],
|
|
3
|
+
"plugins": [],
|
|
4
|
+
"ignorePatterns": ["**/*.svelte", "**/*.vue"],
|
|
5
|
+
|
|
6
|
+
"rules": {
|
|
7
|
+
"@plumeria/no-destructure": "error",
|
|
8
|
+
"@plumeria/no-inner-call": "error",
|
|
9
|
+
"@plumeria/no-unused-keys": "warn",
|
|
10
|
+
"@plumeria/sort-properties": "warn",
|
|
11
|
+
"@plumeria/validate-values": "warn"
|
|
12
|
+
}
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/eslint-plugin",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Plumeria ESLint plugin",
|
|
5
5
|
"author": "Refirst 11",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,14 +14,24 @@
|
|
|
14
14
|
"bugs": {
|
|
15
15
|
"url": "https://github.com/zss-in-js/plumeria/issues"
|
|
16
16
|
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"plumeria",
|
|
19
|
+
"eslint",
|
|
20
|
+
"eslint-plugin",
|
|
21
|
+
"oxlint",
|
|
22
|
+
"lint",
|
|
23
|
+
"css-in-js"
|
|
24
|
+
],
|
|
17
25
|
"sideEffects": false,
|
|
18
26
|
"main": "dist/index.js",
|
|
19
27
|
"types": "dist/index.d.ts",
|
|
20
28
|
"files": [
|
|
21
|
-
"dist/"
|
|
29
|
+
"dist/",
|
|
30
|
+
"oxlint-plugin.js",
|
|
31
|
+
"oxlint.json"
|
|
22
32
|
],
|
|
23
33
|
"bin": {
|
|
24
|
-
"plumerialint": "bin/
|
|
34
|
+
"plumerialint": "bin/oxlint.js"
|
|
25
35
|
},
|
|
26
36
|
"devDependencies": {
|
|
27
37
|
"@types/eslint": "^9.6.1",
|
package/bin/plumerialint.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const { ESLint } = require('eslint');
|
|
4
|
-
const { plumeria } = require('@plumeria/eslint-plugin');
|
|
5
|
-
|
|
6
|
-
async function run() {
|
|
7
|
-
const eslint = new ESLint({
|
|
8
|
-
cwd: process.cwd(),
|
|
9
|
-
overrideConfig: [plumeria.flatConfigs.recommended],
|
|
10
|
-
ignorePatterns: ['**/.*/**'],
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const results = await eslint.lintFiles('**/*.{ts,tsx,js,jsx}');
|
|
14
|
-
|
|
15
|
-
const hasProblem = results.some(
|
|
16
|
-
(r) => r.errorCount > 0 || r.warningCount > 0,
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
const formatter = await eslint.loadFormatter('stylish');
|
|
20
|
-
process.stdout.write(formatter.format(results));
|
|
21
|
-
|
|
22
|
-
if (hasProblem) {
|
|
23
|
-
process.exitCode = 1;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
run().catch((err) => {
|
|
28
|
-
console.error(err);
|
|
29
|
-
process.exit(1);
|
|
30
|
-
});
|