-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy path.eslintrc.js
91 lines (88 loc) · 2.95 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
* Copyright (c) 2020, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
// Specify a tsconfig specifically for eslint with simple glob patterns without project references
// as @typescript-eslint does not support project references:
// https://github.com/typescript-eslint/typescript-eslint/issues/2094
// Without this checking individual files with lint-staged fails:
// https://github.com/typescript-eslint/typescript-eslint/issues/967#issuecomment-531817014
tsconfigRootDir: __dirname,
project: './tsconfig.eslint.json',
},
plugins: [
'@typescript-eslint',
'tsdoc',
'jest',
'prettier',
'notice', // checks for and fixes copyright header in each file
'markdown',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
// TODO (spike): Evaluate using https://github.com/standard/eslint-config-standard-with-typescript
// 'standard-with-typescript',
'plugin:prettier/recommended',
'plugin:import/typescript',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:eslint-comments/recommended',
'plugin:markdown/recommended',
],
settings: {
'import/resolver': {
// Makes plugin:import work with Typescript interfaces etc
typescript: {
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code
},
},
},
rules: {
'notice/notice': [
'error',
{
templateFile: 'license-header.txt',
},
],
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'@typescript-eslint/naming-convention': [
'error',
{
selector: ['variable', 'function'],
format: ['camelCase'],
},
],
'prefer-arrow-callback': 'warn',
},
overrides: [
{
// Enable the Markdown processor for all .md files.
files: ['**/*.md'],
processor: 'markdown/markdown',
},
{
files: ['**/__tests__/*.[j|t]s'],
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
},
{
files: ['**/*.ts'],
rules: {
'tsdoc/syntax': 'warn',
},
},
],
env: {
browser: true,
node: true,
},
ignorePatterns: ['node_modules', 'dist', 'coverage'],
};