/
.eslintrc.js
96 lines (92 loc) · 3.02 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
92
93
94
95
96
module.exports = {
root: true,
plugins: ['jsdoc'],
extends: [
'@ni/eslint-config-typescript',
'@ni/eslint-config-typescript/requiring-type-checking'
],
parserOptions: {
project: '../tsconfig.json',
tsconfigRootDir: __dirname
},
rules: {
// Require non-empty JSDoc comment on class declarations
'jsdoc/require-jsdoc': [
'error',
{
publicOnly: false,
require: {
ClassDeclaration: true,
FunctionDeclaration: false
}
}
],
'jsdoc/require-description': [
'error',
{ contexts: ['ClassDeclaration'] }
],
// *-default-export lines can be deleted once a fix for this issue is published and uptaken
// https://github.com/ni/javascript-styleguide/issues/39
'import/prefer-default-export': 'off',
'import/no-default-export': 'error',
// Rules enabled due to strictNullChecks
'@typescript-eslint/no-non-null-assertion': 'off',
// Improves readability of templates to avoid return types in template expressions
'@typescript-eslint/explicit-function-return-type': [
'error',
{ allowExpressions: true }
],
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@microsoft/fast-foundation',
importNames: ['focusVisible'],
message:
'Please use focusVisible from src/utilities/style/focus instead.'
}
]
}
]
},
ignorePatterns: ['.eslintrc.js'],
overrides: [
{
files: ['*.stories.ts'],
extends: ['plugin:storybook/recommended'],
rules: {
// Storybook files will not be in published package and are allowed to use devDependencies
'import/no-extraneous-dependencies': [
'error',
{ devDependencies: true }
],
'import/no-default-export': 'off',
'storybook/prefer-pascal-case': 'off'
}
},
{
files: ['*.spec.ts'],
env: {
jasmine: true
},
rules: {
// Classes defined in test code aren't part of the public API so don't need docs
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-description': 'off'
}
},
{
files: ['styles.ts'],
rules: {
// template literals are also used to comment on the css and
// the comments should be intended accordingly
'@typescript-eslint/indent': [
'error',
4,
{ ignoredNodes: ['TemplateLiteral'] }
]
}
}
]
};