@bottomlessmargaritas/formatting-configs 2.2.1 → 2.3.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/bin/cli.js +18 -4
- package/configs/eslint.config.js +13 -3
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -118,12 +118,19 @@ function copyConfigFiles(projectRoot) {
|
|
|
118
118
|
copied++;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
// Remove stale namespaced config files from previous versions
|
|
121
|
+
// Remove stale namespaced config files from previous versions.
|
|
122
|
+
// Only remove files that match known config patterns (eslint/prettier) to avoid
|
|
123
|
+
// deleting user files that happen to contain the namespace in their name.
|
|
124
|
+
const KNOWN_CONFIG_PREFIXES = ["eslint.config.", "prettier.config."];
|
|
122
125
|
const namespacedPattern = `.${NAMESPACE}.`;
|
|
123
126
|
let removed = 0;
|
|
124
127
|
|
|
125
128
|
for (const file of readdirSync(projectRoot)) {
|
|
126
|
-
if (
|
|
129
|
+
if (
|
|
130
|
+
file.includes(namespacedPattern) &&
|
|
131
|
+
!currentNamespacedFiles.has(file) &&
|
|
132
|
+
KNOWN_CONFIG_PREFIXES.some((prefix) => file.startsWith(prefix))
|
|
133
|
+
) {
|
|
127
134
|
if (isDryRun) {
|
|
128
135
|
console.log(`[dry-run] Would remove stale config: ${file}`);
|
|
129
136
|
} else {
|
|
@@ -157,9 +164,16 @@ function updatePackageJsonScripts(projectRoot) {
|
|
|
157
164
|
}
|
|
158
165
|
}
|
|
159
166
|
|
|
160
|
-
// Remove stale namespaced scripts from previous versions
|
|
167
|
+
// Remove stale namespaced scripts from previous versions.
|
|
168
|
+
// Only remove scripts matching known prefixes (format/lint) to avoid
|
|
169
|
+
// deleting user-defined scripts that happen to use the namespace prefix.
|
|
170
|
+
const KNOWN_SCRIPT_PREFIXES = [`${NAMESPACE}:format`, `${NAMESPACE}:lint`];
|
|
161
171
|
for (const name of Object.keys(pkg.scripts)) {
|
|
162
|
-
if (
|
|
172
|
+
if (
|
|
173
|
+
name.startsWith(`${NAMESPACE}:`) &&
|
|
174
|
+
!currentScriptNames.has(name) &&
|
|
175
|
+
KNOWN_SCRIPT_PREFIXES.some((prefix) => name.startsWith(prefix))
|
|
176
|
+
) {
|
|
163
177
|
delete pkg.scripts[name];
|
|
164
178
|
removed++;
|
|
165
179
|
}
|
package/configs/eslint.config.js
CHANGED
|
@@ -11,7 +11,14 @@ import tseslint from 'typescript-eslint';
|
|
|
11
11
|
|
|
12
12
|
export default tseslint.config([
|
|
13
13
|
{
|
|
14
|
-
ignores: [
|
|
14
|
+
ignores: [
|
|
15
|
+
'**/build/**',
|
|
16
|
+
'**/dist/**',
|
|
17
|
+
'**/node_modules/**',
|
|
18
|
+
'**/*.d.ts',
|
|
19
|
+
'**/.turbo/**',
|
|
20
|
+
'**/.next/**',
|
|
21
|
+
],
|
|
15
22
|
},
|
|
16
23
|
{
|
|
17
24
|
linterOptions: {
|
|
@@ -23,7 +30,7 @@ export default tseslint.config([
|
|
|
23
30
|
'unused-imports': unusedImports,
|
|
24
31
|
},
|
|
25
32
|
rules: {
|
|
26
|
-
|
|
33
|
+
curly: 'error',
|
|
27
34
|
'no-console': ['warn', { allow: ['warn', 'info', 'error', 'group'] }],
|
|
28
35
|
'no-implicit-globals': 'error',
|
|
29
36
|
'no-param-reassign': ['error', { props: false }],
|
|
@@ -80,7 +87,10 @@ export default tseslint.config([
|
|
|
80
87
|
},
|
|
81
88
|
},
|
|
82
89
|
rules: {
|
|
83
|
-
'@typescript-eslint/ban-ts-comment': [
|
|
90
|
+
'@typescript-eslint/ban-ts-comment': [
|
|
91
|
+
'warn',
|
|
92
|
+
{ 'ts-ignore': 'allow-with-description' },
|
|
93
|
+
],
|
|
84
94
|
'@typescript-eslint/consistent-type-definitions': 'off',
|
|
85
95
|
'@typescript-eslint/consistent-type-imports': [
|
|
86
96
|
'warn',
|