Skip to content

Commit

Permalink
maint/dev ~ (ESLint) update config; merge Deno and JS configs
Browse files Browse the repository at this point in the history
  • Loading branch information
rivy committed Aug 20, 2022
1 parent 7d28a76 commit d5d73f5
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
// ESLint configuration
// ref: <https://eslint.org/docs/latest/user-guide/configuring/configuration-files>
// v2022-07-31 [rivy]
// v2022-08-20 [rivy]

// spell-checker:ignore (names) rivy ; (options) iife

/* @prettier */ // note: (dprint) {.dprint.json}.prettier.associations should contain the name of this file

const useDeno = true;
const usePrettier = !useDeno;

module.exports = {
root: true,
env: { es6: true },
ignorePatterns: [
'[._@#$]build',
'[._@#$]coverage',
'.eslintrc.js',
'.nyc_output',
'build',
Expand All @@ -28,33 +35,35 @@ module.exports = {
'plugin:import/typescript',
'plugin:security/recommended',
'plugin:security-node/recommended',
'prettier',
'prettier/@typescript-eslint',
...(usePrettier ? ['prettier', 'prettier/@typescript-eslint'] : []),
],
rules: {
// ref: https://eslint.org/docs/rules
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
'eslint-comments/no-unused-disable': 'warn',
'import/order': ['error', { 'newlines-between': 'always', alphabetize: { order: 'asc' } }],
'no-console': ['warn'], // ref: https://eslint.org/docs/rules/no-console
'no-restricted-syntax': [
'error',
{
selector: `CallExpression[callee.object.name='console'][callee.property.name!=/^(log|warn|error|info|trace)$/]`,
message: 'Unexpected property on console object was called',
},
],
'no-undefined': ['error'], // ref: https://eslint.org/docs/rules/no-undefined
'no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }], // ref: https://eslint.org/docs/rules/no-unused-vars
'sort-imports': ['error', { ignoreDeclarationSort: true, ignoreCase: true }],
'wrap-iife': ['error', 'inside'], // correlate with Prettier formatting choice; ref: https://eslint.org/docs/rules/wrap-iife
},
overrides: [
{
files: ['*.js'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
],
overrides: [{ files: ['*.js'], rules: { '@typescript-eslint/no-var-requires': 'off' } }],
// globals: { BigInt: true, console: true, WebAssembly: true },
// globals: { Atomics: 'readonly', SharedArrayBuffer: 'readonly' },
};

0 comments on commit d5d73f5

Please sign in to comment.