Skip to content

Commit 5b135e5

Browse files
committed
feat: support using error instead of warn for rules in config
1 parent 15185f5 commit 5b135e5

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

tools/update-lib-configs.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ function formatRules(rules, categoryId) {
4444
return [rule.ruleId, options]
4545
})
4646
)
47-
return JSON.stringify(obj, null, 2)
47+
// use the ruleLevel variable for rules set to warn so that they can
48+
// be made to error with an env variable if desired
49+
return JSON.stringify(obj, null, 2).replaceAll('"warn"', 'ruleLevel')
4850
}
4951

5052
function formatCategory(category) {
@@ -55,6 +57,8 @@ function formatCategory(category) {
5557
* This file has been automatically generated,
5658
* in order to update its content execute "npm run update"
5759
*/
60+
const ruleLevel = process.env.VUE_ESLINT_ALWAYS_ERROR === 'true' ? 'error' : 'warn'
61+
5862
module.exports = {
5963
parserOptions: {
6064
ecmaVersion: 'latest',
@@ -78,6 +82,8 @@ module.exports = {
7882
* This file has been automatically generated,
7983
* in order to update its content execute "npm run update"
8084
*/
85+
const ruleLevel = process.env.VUE_ESLINT_ALWAYS_ERROR === 'true' ? 'error' : 'warn'
86+
8187
module.exports = {
8288
extends: require.resolve('./${extendsCategoryId}'),
8389
rules: ${formatRules(category.rules, category.categoryId)}

tools/update-lib-flat-configs.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ function formatRules(rules, categoryId) {
4444
return [rule.ruleId, options]
4545
})
4646
)
47-
return JSON.stringify(obj, null, 2)
47+
// use the ruleLevel variable for rules set to warn so that they can
48+
// be made to error with an env variable if desired
49+
return JSON.stringify(obj, null, 2).replaceAll('"warn"', 'ruleLevel')
4850
}
4951

5052
function formatCategory(category) {
@@ -55,6 +57,8 @@ function formatCategory(category) {
5557
* This file has been automatically generated,
5658
* in order to update its content execute "npm run update"
5759
*/
60+
const ruleLevel = process.env.VUE_ESLINT_ALWAYS_ERROR === 'true' ? 'error' : 'warn'
61+
5862
module.exports = [
5963
{
6064
name: 'vue/base/setup',
@@ -93,6 +97,8 @@ module.exports = [
9397
'use strict'
9498
const config = require('./${extendsCategoryId}.js')
9599
100+
const ruleLevel = process.env.VUE_ESLINT_ALWAYS_ERROR === 'true' ? 'error' : 'warn'
101+
96102
module.exports = [
97103
...config,
98104
{

0 commit comments

Comments
 (0)