Skip to content

Commit

Permalink
Refactor eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
LogvinovLeon committed Feb 29, 2024
1 parent 47b8ea4 commit b7e0745
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
const allowMagicNumbersInTests = {
files: ['*.test.ts'],
rules: {
'no-magic-numbers': 'off'
}
};

const parseConfigFilesAsScripts = {
files: ['.eslintrc.{js,cjs}'],
parserOptions: {
sourceType: 'script'
},
env: {
node: true
}
};

module.exports = {
root: true,
ignorePatterns: ['**/.eslintrc.cjs'],
Expand All @@ -17,21 +34,5 @@ module.exports = {
],
'no-magic-numbers': ['error', { ignore: [0, 1, 16, 256, '0n', '1n'] }]
},
overrides: [
{
env: {
node: true
},
files: ['.eslintrc.{js,cjs}'],
parserOptions: {
sourceType: 'script'
}
},
{
files: ['*.test.ts'],
rules: {
'no-magic-numbers': 'off'
}
}
]
overrides: [parseConfigFilesAsScripts, allowMagicNumbersInTests]
};

0 comments on commit b7e0745

Please sign in to comment.