Skip to content

Commit 345a5d2

Browse files
authored
chore: disable no-console eslint rule for cli packages and tests (#1226)
* chore: disable no-console eslint rule for cli packages and tests * fix: format
1 parent d4cd3a4 commit 345a5d2

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

.eslintrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@
1616
"project": ["tsconfig.json"]
1717
},
1818
"extends": ["@scaleway/react/typescript"]
19+
},
20+
{
21+
"files": [
22+
"packages/changesets-renovate/**/*.ts{x,}",
23+
"packages/validate-icu-locales/**/*.ts{x,}",
24+
"**/__tests__/**/*.ts{x,}"
25+
],
26+
"parserOptions": {
27+
"project": ["tsconfig.json"]
28+
},
29+
"extends": ["@scaleway/react/typescript"],
30+
"rules": {
31+
"no-console": "off"
32+
}
1933
}
2034
]
2135
}

packages/validate-icu-locales/src/index.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { importFromString } from 'module-from-string'
88

99
const args = process.argv.slice(2)
1010
const pattern = args[0]
11-
const { error, table } = console
1211

1312
type Locales = Record<string, string>
1413
type ErrorICU = {
@@ -65,7 +64,7 @@ const readFiles = async (files: string[]): Promise<ErrorsICU> => {
6564
const ICUErrors = findICUErrors(locales, file)
6665
errors.push(...ICUErrors)
6766
} catch (err) {
68-
error({ file, err })
67+
console.error({ file, err })
6968
}
7069
}
7170

@@ -85,13 +84,13 @@ const readFiles = async (files: string[]): Promise<ErrorsICU> => {
8584
const ICUErrors = findICUErrors(locales, file)
8685
errors.push(...ICUErrors)
8786
} else {
88-
error('export default from: ', file, ' is not an object')
87+
console.error('export default from: ', file, ' is not an object')
8988
}
9089
} else {
91-
error(file, ' is not an object')
90+
console.error(file, ' is not an object')
9291
}
9392
} catch (err) {
94-
error({ err, file })
93+
console.error({ err, file })
9594
}
9695
}
9796
}
@@ -100,23 +99,23 @@ const readFiles = async (files: string[]): Promise<ErrorsICU> => {
10099
}
101100

102101
if (!pattern) {
103-
error('Missing pattern: validate-icu-locales [PATTERN]')
102+
console.error('Missing pattern: validate-icu-locales [PATTERN]')
104103
process.exit(1)
105104
}
106105

107106
const files = await globby(pattern)
108107

109108
if (files.length === 0) {
110-
error('There is no files matching this pattern', pattern)
109+
console.error('There is no files matching this pattern', pattern)
111110
process.exit(1)
112111
}
113112

114-
table(files)
113+
console.table(files)
115114

116115
const errors = await readFiles(files)
117116

118117
if (errors.length > 0) {
119-
error({
118+
console.error({
120119
errors,
121120
})
122121
process.exit(1)

0 commit comments

Comments
 (0)