@dvukovic/style-guide 0.8.0 → 0.10.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 +3 -3
- package/dist/cli/generators/prettier.d.ts +1 -0
- package/dist/stylelint/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/cli/generators/prettier.js +10 -0
- package/src/cli/generators/scripts.js +2 -2
- package/src/cli/generators/stylelint.js +2 -2
- package/src/cli/init.js +6 -3
- package/src/eslint/index.js +4 -0
- package/src/stylelint/index.js +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Personal style guide with ESLint, Prettier, Stylelint, and CSpell configurations
|
|
|
5
5
|
## Quick Start
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npx @dvukovic/style-guide@latest init
|
|
8
|
+
npx -y @dvukovic/style-guide@latest init
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
This interactive CLI will:
|
|
@@ -88,11 +88,11 @@ export default config
|
|
|
88
88
|
Create `stylelint.config.js`:
|
|
89
89
|
|
|
90
90
|
```js
|
|
91
|
-
import
|
|
91
|
+
import { core } from "@dvukovic/style-guide/stylelint"
|
|
92
92
|
|
|
93
93
|
/** @type {import("stylelint").Config} */
|
|
94
94
|
const config = {
|
|
95
|
-
...
|
|
95
|
+
...core,
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
export default config
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as core
|
|
1
|
+
export { default as core } from "./configs/core.js";
|
package/package.json
CHANGED
|
@@ -10,3 +10,13 @@ const config: Config = {
|
|
|
10
10
|
export default config
|
|
11
11
|
`
|
|
12
12
|
}
|
|
13
|
+
|
|
14
|
+
export function generatePrettierIgnore(options = {}) {
|
|
15
|
+
const lines = ["**/__generated__/**", "**/*.d.json.ts"]
|
|
16
|
+
|
|
17
|
+
if (options.isNextJs) {
|
|
18
|
+
lines.push(".next", "public")
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return `${lines.join("\n")}\n`
|
|
22
|
+
}
|
|
@@ -12,7 +12,7 @@ export function generateScripts(tools, packageManager) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
if (tools.includes("prettier")) {
|
|
15
|
-
scripts["lint:prettier"] = "prettier --check --cache ."
|
|
15
|
+
scripts["lint:prettier"] = "prettier --log-level=warn --check --cache ."
|
|
16
16
|
lintParts.push(`${runner} lint:prettier`)
|
|
17
17
|
fixParts.push(`${runner} lint:prettier --write`)
|
|
18
18
|
}
|
|
@@ -29,7 +29,7 @@ export function generateScripts(tools, packageManager) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
if (tools.includes("knip")) {
|
|
32
|
-
scripts["lint:knip"] = "knip"
|
|
32
|
+
scripts["lint:knip"] = "knip --cache"
|
|
33
33
|
lintParts.push(`${runner} lint:knip`)
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export function generateStylelintConfig() {
|
|
2
|
-
return `import
|
|
2
|
+
return `import { core } from "@dvukovic/style-guide/stylelint"
|
|
3
3
|
|
|
4
4
|
/** @type {import("stylelint").Config} */
|
|
5
5
|
const config = {
|
|
6
|
-
...
|
|
6
|
+
...core,
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export default config
|
package/src/cli/init.js
CHANGED
|
@@ -7,7 +7,7 @@ import * as clack from "@clack/prompts"
|
|
|
7
7
|
import { generateCspellConfig } from "./generators/cspell.js"
|
|
8
8
|
import { generateESLintConfig } from "./generators/eslint.js"
|
|
9
9
|
import { generateKnipConfig } from "./generators/knip.js"
|
|
10
|
-
import { generatePrettierConfig } from "./generators/prettier.js"
|
|
10
|
+
import { generatePrettierConfig, generatePrettierIgnore } from "./generators/prettier.js"
|
|
11
11
|
import { generateScripts } from "./generators/scripts.js"
|
|
12
12
|
import { generateStylelintConfig } from "./generators/stylelint.js"
|
|
13
13
|
import {
|
|
@@ -181,9 +181,12 @@ export async function runInit() {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
if (tools.includes("prettier")) {
|
|
184
|
-
const
|
|
184
|
+
const isNextJs = eslintOptions?.framework === "next"
|
|
185
185
|
|
|
186
|
-
results.push(
|
|
186
|
+
results.push(
|
|
187
|
+
{ content: generatePrettierConfig(), filename: "prettier.config.ts" },
|
|
188
|
+
{ content: generatePrettierIgnore({ isNextJs }), filename: ".prettierignore" },
|
|
189
|
+
)
|
|
187
190
|
}
|
|
188
191
|
|
|
189
192
|
if (tools.includes("stylelint")) {
|
package/src/eslint/index.js
CHANGED
package/src/stylelint/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as core
|
|
1
|
+
export { default as core } from "./configs/core.js"
|