Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bebba95

Browse files
feat: add vscode config for ESLint (#467)
1 parent 8ef4e48 commit bebba95

File tree

6 files changed

+20
-7
lines changed

6 files changed

+20
-7
lines changed

‎index.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ async function init() {
120120
argv.nightwatch ??
121121
argv.playwright ??
122122
argv.eslint ??
123+
argv['eslint-with-prettier'] ??
123124
(argv.devtools || argv['vue-devtools'])
124125
) === 'boolean'
125126

@@ -463,6 +464,7 @@ async function init() {
463464
needsPrettier,
464465
needsPlaywright
465466
})
467+
render('config/eslint')
466468
}
467469

468470
if (needsPrettier) {

‎scripts/snapshot.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function fullCombination(arr) {
5454
}
5555

5656
let flagCombinations = fullCombination(featureFlags)
57-
flagCombinations.push(['default'], ['devtools'])
57+
flagCombinations.push(['default'], ['devtools'],['eslint'],['eslint-with-prettier'])
5858

5959
// `--with-tests` are equivalent of `--vitest --cypress`
6060
// Previously it means `--cypress` without `--vitest`.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["dbaeumer.vscode-eslint"]
3+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"editor.codeActionsOnSave": {
3+
"source.fixAll": "explicit"
4+
}
5+
}

‎utils/renderEslint.ts‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,4 @@ export default function renderEslint(
8585
const fullPath = path.resolve(rootDir, fileName)
8686
fs.writeFileSync(fullPath, content as string, 'utf-8')
8787
}
88-
89-
// update .vscode/extensions.json
90-
const extensionsJsonPath = path.resolve(rootDir, '.vscode/extensions.json')
91-
const existingExtensions = JSON.parse(fs.readFileSync(extensionsJsonPath, 'utf8'))
92-
existingExtensions.recommendations.push('dbaeumer.vscode-eslint')
93-
fs.writeFileSync(extensionsJsonPath, JSON.stringify(existingExtensions, null, 2) + '\n', 'utf-8')
9488
}

‎utils/renderTemplate.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ function renderTemplate(src, dest, callbacks) {
5151
return
5252
}
5353

54+
if (filename === 'settings.json' && fs.existsSync(dest)) {
55+
// merge instead of overwriting
56+
const settings = JSON.parse(fs.readFileSync(dest, 'utf8'))
57+
const newSettings = JSON.parse(fs.readFileSync(src, 'utf8'))
58+
const extensions = deepMerge(settings, newSettings)
59+
fs.writeFileSync(dest, JSON.stringify(settings, null, 2) + '\n')
60+
return
61+
}
62+
5463
if (filename.startsWith('_')) {
5564
// rename `_file` to `.file`
5665
dest = path.resolve(path.dirname(dest), filename.replace(/^_/, '.'))

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /