Skip to content

Commit ca8d1fd

Browse files
FloEdelmannaladdin-add
authored andcommitted
Extract common comment into constant
1 parent 307d696 commit ca8d1fd

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

tools/update-lib-configs.js

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ const categories = require('./lib/categories')
1616

1717
const errorCategories = new Set(['base', 'essential', 'vue3-essential'])
1818

19+
const autoGeneratedMessage = `/*
20+
* IMPORTANT!
21+
* This file has been automatically generated,
22+
* in order to update its content execute "npm run update"
23+
*/`
24+
1925
const extendsCategories = {
2026
base: null,
2127
essential: 'base',
@@ -51,11 +57,7 @@ function formatCategory(category, flat = false) {
5157
const extendsCategoryId = extendsCategories[category.categoryId]
5258
if (extendsCategoryId == null) {
5359
return flat
54-
? `/*
55-
* IMPORTANT!
56-
* This file has been automatically generated,
57-
* in order to update its content execute "npm run update"
58-
*/
60+
? `${autoGeneratedMessage}
5961
const globals = require('globals')
6062
const vueEslintParser = require('vue-eslint-parser')
6163
module.exports = {
@@ -73,11 +75,7 @@ module.exports = {
7375
rules: ${formatRules(category.rules, category.categoryId)}
7476
}
7577
`
76-
: `/*
77-
* IMPORTANT!
78-
* This file has been automatically generated,
79-
* in order to update its content execute "npm run update"
80-
*/
78+
: `${autoGeneratedMessage}
8179
module.exports = {
8280
parser: require.resolve('vue-eslint-parser'),
8381
parserOptions: {
@@ -96,22 +94,14 @@ module.exports = {
9694
`
9795
}
9896
return flat
99-
? `/*
100-
* IMPORTANT!
101-
* This file has been automatically generated,
102-
* in order to update its content execute "npm run update"
103-
*/
97+
? `${autoGeneratedMessage}
10498
const extendedConfig = require('./${extendsCategoryId}')
10599
module.exports = {
106100
extendedConfig,
107101
rules: ${formatRules(category.rules, category.categoryId)}
108102
}
109103
`
110-
: `/*
111-
* IMPORTANT!
112-
* This file has been automatically generated,
113-
* in order to update its content execute "npm run update"
114-
*/
104+
: `${autoGeneratedMessage}
115105
module.exports = {
116106
extends: require.resolve('./${extendsCategoryId}'),
117107
rules: ${formatRules(category.rules, category.categoryId)}

0 commit comments

Comments
 (0)