@jterrazz/codestyle 1.2.4 → 1.2.6
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/LICENSE +1 -1
- package/README.md +18 -18
- package/package.json +13 -20
- package/src/codestyle.sh +15 -5
- package/src/oxlint/base.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) Jean-Baptiste Terrazzoni <contact@jterrazz.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -12,10 +12,12 @@ Create `.oxlintrc.json`:
|
|
|
12
12
|
|
|
13
13
|
```json
|
|
14
14
|
{
|
|
15
|
-
|
|
15
|
+
"extends": ["node_modules/@jterrazz/codestyle/src/oxlint/node.json"]
|
|
16
16
|
}
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
> **Note:** The `node_modules/` path is required because oxlint doesn't support npm module resolution in `extends`.
|
|
20
|
+
|
|
19
21
|
Run:
|
|
20
22
|
|
|
21
23
|
```bash
|
|
@@ -25,21 +27,19 @@ npx codestyle --fix # Fix everything
|
|
|
25
27
|
|
|
26
28
|
## Configurations
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
| -------------------------------------------------------------------------- | ---------------------------------- |
|
|
30
|
-
| `node_modules/@jterrazz/codestyle/src/oxlint/node.json` | Node.js (requires .js extensions) |
|
|
31
|
-
| `node_modules/@jterrazz/codestyle/src/oxlint/expo.json` | Expo / React Native |
|
|
32
|
-
| `node_modules/@jterrazz/codestyle/src/oxlint/nextjs.json` | Next.js |
|
|
33
|
-
| `node_modules/@jterrazz/codestyle/src/oxlint/architectures/hexagonal.json` | Hexagonal architecture enforcement |
|
|
30
|
+
Base configurations (pick one):
|
|
34
31
|
|
|
35
|
-
|
|
32
|
+
| Config | Use Case |
|
|
33
|
+
| --------------------------------------------------------- | --------------------------------- |
|
|
34
|
+
| `node_modules/@jterrazz/codestyle/src/oxlint/node.json` | Node.js (requires .js extensions) |
|
|
35
|
+
| `node_modules/@jterrazz/codestyle/src/oxlint/expo.json` | Expo / React Native |
|
|
36
|
+
| `node_modules/@jterrazz/codestyle/src/oxlint/nextjs.json` | Next.js |
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
- Custom rules: architecture boundaries, import extensions
|
|
38
|
+
Architecture plugins (additive, combine with any base config):
|
|
39
|
+
|
|
40
|
+
| Plugin | Use Case |
|
|
41
|
+
| -------------------------------------------------------------------------- | ---------------------------------- |
|
|
42
|
+
| `node_modules/@jterrazz/codestyle/src/oxlint/architectures/hexagonal.json` | Hexagonal architecture enforcement |
|
|
43
43
|
|
|
44
44
|
## CLI
|
|
45
45
|
|
|
@@ -58,10 +58,10 @@ Enforce hexagonal architecture boundaries:
|
|
|
58
58
|
|
|
59
59
|
```json
|
|
60
60
|
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
"extends": [
|
|
62
|
+
"node_modules/@jterrazz/codestyle/src/oxlint/node.json",
|
|
63
|
+
"node_modules/@jterrazz/codestyle/src/oxlint/architectures/hexagonal.json"
|
|
64
|
+
]
|
|
65
65
|
}
|
|
66
66
|
```
|
|
67
67
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jterrazz/codestyle",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"author": "Jean-Baptiste Terrazzoni <contact@jterrazz.com>",
|
|
5
5
|
"bin": {
|
|
6
6
|
"codestyle": "./src/codestyle.sh"
|
|
@@ -12,38 +12,31 @@
|
|
|
12
12
|
"main": "src/index.js",
|
|
13
13
|
"exports": {
|
|
14
14
|
".": "./src/index.js",
|
|
15
|
+
"./oxfmt": "./src/oxfmt/index.json",
|
|
15
16
|
"./oxlint/node": "./src/oxlint/node.json",
|
|
16
17
|
"./oxlint/expo": "./src/oxlint/expo.json",
|
|
17
18
|
"./oxlint/nextjs": "./src/oxlint/nextjs.json",
|
|
18
19
|
"./oxlint/architectures/hexagonal": "./src/oxlint/architectures/hexagonal.json",
|
|
19
20
|
"./oxlint/plugins/codestyle": "./src/oxlint/plugins/codestyle.js",
|
|
20
|
-
"./
|
|
21
|
+
"./src/oxlint/plugins/codestyle.js": "./src/oxlint/plugins/codestyle.js"
|
|
21
22
|
},
|
|
22
23
|
"publishConfig": {
|
|
23
24
|
"registry": "https://registry.npmjs.org/"
|
|
24
25
|
},
|
|
25
26
|
"scripts": {
|
|
26
|
-
"
|
|
27
|
-
"lint
|
|
28
|
-
"
|
|
29
|
-
"test
|
|
30
|
-
"build": "# no build script"
|
|
27
|
+
"build": "# no build script",
|
|
28
|
+
"lint": "./src/codestyle.sh --ignore-pattern '**/fixtures/**'",
|
|
29
|
+
"lint:fix": "./src/codestyle.sh --fix --ignore-pattern '**/fixtures/**'",
|
|
30
|
+
"test": "vitest --run"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@typescript
|
|
34
|
-
"eslint-plugin-perfectionist": "^4.
|
|
35
|
-
"oxfmt": "^0.
|
|
36
|
-
"oxlint": "^1.
|
|
33
|
+
"@jterrazz/typescript": "^4.2.1",
|
|
34
|
+
"eslint-plugin-perfectionist": "^5.4.0",
|
|
35
|
+
"oxfmt": "^0.26.0",
|
|
36
|
+
"oxlint": "^1.41.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
"peerDependencies": {
|
|
42
|
-
"@types/node": "*"
|
|
43
|
-
},
|
|
44
|
-
"peerDependenciesMeta": {
|
|
45
|
-
"@types/node": {
|
|
46
|
-
"optional": true
|
|
47
|
-
}
|
|
39
|
+
"@types/node": "^25.0.10",
|
|
40
|
+
"vitest": "^4.0.18"
|
|
48
41
|
}
|
|
49
42
|
}
|
package/src/codestyle.sh
CHANGED
|
@@ -14,26 +14,36 @@ RUN_LINT=false
|
|
|
14
14
|
RUN_FORMAT=false
|
|
15
15
|
RUN_ALL=true
|
|
16
16
|
EXTRA_ARGS=()
|
|
17
|
+
LINT_ARGS=()
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
case $
|
|
19
|
+
while [[ $# -gt 0 ]]; do
|
|
20
|
+
case $1 in
|
|
20
21
|
--fix)
|
|
21
22
|
FIX_MODE=true
|
|
23
|
+
shift
|
|
22
24
|
;;
|
|
23
25
|
--type)
|
|
24
26
|
RUN_TYPE=true
|
|
25
27
|
RUN_ALL=false
|
|
28
|
+
shift
|
|
26
29
|
;;
|
|
27
30
|
--lint)
|
|
28
31
|
RUN_LINT=true
|
|
29
32
|
RUN_ALL=false
|
|
33
|
+
shift
|
|
30
34
|
;;
|
|
31
35
|
--format)
|
|
32
36
|
RUN_FORMAT=true
|
|
33
37
|
RUN_ALL=false
|
|
38
|
+
shift
|
|
39
|
+
;;
|
|
40
|
+
--ignore-pattern)
|
|
41
|
+
LINT_ARGS+=("$1" "$2")
|
|
42
|
+
shift 2
|
|
34
43
|
;;
|
|
35
44
|
*)
|
|
36
|
-
EXTRA_ARGS+=("$
|
|
45
|
+
EXTRA_ARGS+=("$1")
|
|
46
|
+
shift
|
|
37
47
|
;;
|
|
38
48
|
esac
|
|
39
49
|
done
|
|
@@ -88,9 +98,9 @@ fi
|
|
|
88
98
|
|
|
89
99
|
if [ "$RUN_LINT" = true ]; then
|
|
90
100
|
if [ "$FIX_MODE" = true ]; then
|
|
91
|
-
"$BIN_DIR/oxlint" --fix "${EXTRA_ARGS[@]:-.}" > "$tmp_dir/code.log" 2>&1 &
|
|
101
|
+
"$BIN_DIR/oxlint" --fix "${LINT_ARGS[@]}" "${EXTRA_ARGS[@]:-.}" > "$tmp_dir/code.log" 2>&1 &
|
|
92
102
|
else
|
|
93
|
-
"$BIN_DIR/oxlint" "${EXTRA_ARGS[@]:-.}" > "$tmp_dir/code.log" 2>&1 &
|
|
103
|
+
"$BIN_DIR/oxlint" "${LINT_ARGS[@]}" "${EXTRA_ARGS[@]:-.}" > "$tmp_dir/code.log" 2>&1 &
|
|
94
104
|
fi
|
|
95
105
|
code_pid=$!
|
|
96
106
|
fi
|
package/src/oxlint/base.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
|
|
3
3
|
"plugins": ["typescript", "import", "oxc", "unicorn"],
|
|
4
|
-
"jsPlugins": ["eslint-plugin-perfectionist", "
|
|
4
|
+
"jsPlugins": ["eslint-plugin-perfectionist", "./plugins/codestyle.js"],
|
|
5
5
|
"categories": {
|
|
6
6
|
"correctness": "error",
|
|
7
7
|
"suspicious": "error",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"type": "alphabetical",
|
|
49
49
|
"order": "asc",
|
|
50
50
|
"ignoreCase": true,
|
|
51
|
-
"newlinesBetween":
|
|
51
|
+
"newlinesBetween": 1,
|
|
52
52
|
"groups": [
|
|
53
53
|
["builtin", "external"],
|
|
54
54
|
"internal",
|