Skip to content

Commit

Permalink
Fix de la règle @typescript-eslint/restrict-template-expressions (la …
Browse files Browse the repository at this point in the history
…config par défaut avait changé)
  • Loading branch information
n-e committed Sep 5, 2023
1 parent b022af3 commit e70b630
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/index.js
Expand Up @@ -310,7 +310,18 @@ module.exports = {
'@typescript-eslint/restrict-plus-operands': 'error',
'@typescript-eslint/restrict-template-expressions': [
'error',
{ allowNumber: true },
{
// On autorise les any, car il y a déjà d'autres règles qui empêchent les any excessifs
allowAny: true,

// On évite ainsi des null ou undefined avec les types de style string | undefined
allowNullish: false,

// ces types s'impriment de façon propre ou intuitive
allowBoolean: true,
allowNumber: true,
allowRegExp: true,
},
],
'@typescript-eslint/return-await': ['error', 'always'],
'@typescript-eslint/semi': ['error', 'always'],
Expand Down
24 changes: 24 additions & 0 deletions test/__snapshots__/rules.test.ts.snap
Expand Up @@ -372,7 +372,11 @@ exports[`ESLint rules should match defined rules for e2e.js: Applied rules 1`] =
"@typescript-eslint/restrict-template-expressions": [
"error",
{
"allowAny": true,
"allowBoolean": true,
"allowNullish": false,
"allowNumber": true,
"allowRegExp": true,
},
],
"@typescript-eslint/return-await": [
Expand Down Expand Up @@ -2120,7 +2124,11 @@ exports[`ESLint rules should match defined rules for e2e.ts: Applied rules 1`] =
"@typescript-eslint/restrict-template-expressions": [
"error",
{
"allowAny": true,
"allowBoolean": true,
"allowNullish": false,
"allowNumber": true,
"allowRegExp": true,
},
],
"@typescript-eslint/return-await": [
Expand Down Expand Up @@ -3868,7 +3876,11 @@ exports[`ESLint rules should match defined rules for js: Applied rules 1`] = `
"@typescript-eslint/restrict-template-expressions": [
"error",
{
"allowAny": true,
"allowBoolean": true,
"allowNullish": false,
"allowNumber": true,
"allowRegExp": true,
},
],
"@typescript-eslint/return-await": [
Expand Down Expand Up @@ -5616,7 +5628,11 @@ exports[`ESLint rules should match defined rules for test.js: Applied rules 1`]
"@typescript-eslint/restrict-template-expressions": [
"error",
{
"allowAny": true,
"allowBoolean": true,
"allowNullish": false,
"allowNumber": true,
"allowRegExp": true,
},
],
"@typescript-eslint/return-await": [
Expand Down Expand Up @@ -7364,7 +7380,11 @@ exports[`ESLint rules should match defined rules for test.ts: Applied rules 1`]
"@typescript-eslint/restrict-template-expressions": [
"error",
{
"allowAny": true,
"allowBoolean": true,
"allowNullish": false,
"allowNumber": true,
"allowRegExp": true,
},
],
"@typescript-eslint/return-await": [
Expand Down Expand Up @@ -9112,7 +9132,11 @@ exports[`ESLint rules should match defined rules for ts: Applied rules 1`] = `
"@typescript-eslint/restrict-template-expressions": [
"error",
{
"allowAny": true,
"allowBoolean": true,
"allowNullish": false,
"allowNumber": true,
"allowRegExp": true,
},
],
"@typescript-eslint/return-await": [
Expand Down

0 comments on commit e70b630

Please sign in to comment.