-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
71 lines (67 loc) · 2.68 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// ESLint configuration
// ref: <https://eslint.org/docs/latest/user-guide/configuring/configuration-files>
// v2023-02-05 [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',
'.yarn',
'build',
'coverage',
'dist',
'node_modules',
'vendor',
],
parser: '@typescript-eslint/parser',
// avoid `parserOptions` ~ [2020-10-29]/rivy ~ use is causing issues for eslint evaluation of files outside of `src` (see https://github.com/typescript-eslint/typescript-eslint/issues/1723)
// parserOptions: { ecmaVersion: 6, project: ['./tsconfig.json', './tsconfig.eslint.json'] },
plugins: ['import', 'functional', '@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:eslint-comments/recommended',
'plugin:functional/lite',
'plugin:import/typescript',
'plugin:security/recommended',
'plugin:security-node/recommended',
...(usePrettier ? ['prettier', 'prettier/@typescript-eslint'] : []),
],
reportUnusedDisableDirectives: true,
rules: {
// ref: https://eslint.org/docs/rules
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
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' } }],
// globals: { BigInt: true, console: true, WebAssembly: true },
// globals: { Atomics: 'readonly', SharedArrayBuffer: 'readonly' },
};