UNPKG

5.3 kBJavaScriptView Raw
1module.exports = {
2 extends: [
3 'airbnb',
4 // Extended configs are applied in order, so these configs that turn other rules off should come last
5 'prettier',
6 'plugin:@typescript-eslint/eslint-recommended', // disable some rules not needed for TS
7 ],
8 parser: '@typescript-eslint/parser',
9 plugins: ['@typescript-eslint', 'jest', 'import', 'react-hooks', '@fluentui'],
10 env: {
11 browser: true,
12 'jest/globals': true,
13 },
14 // matched relative to cwd
15 ignorePatterns: ['coverage', 'dist', 'etc', 'lib', 'lib-commonjs', 'node_modules', 'temp'],
16 rules: {
17 '@fluentui/no-global-react': 'error',
18 '@fluentui/no-tslint-comments': 'error',
19
20 'react-hooks/exhaustive-deps': 'error',
21 'react-hooks/rules-of-hooks': 'error',
22
23 'import/no-default-export': 'error',
24 'import/no-extraneous-dependencies': [
25 'error',
26 { devDependencies: ['**/*-test.ts*', '**/*.test.ts*', '*.config.js', 'gulpfile.ts', 'just.config.ts'] },
27 ],
28
29 // False positive on arg types:
30 // https://github.com/typescript-eslint/typescript-eslint/issues/46
31 '@typescript-eslint/no-unused-vars': ['error', { args: 'none', ignoreRestSiblings: true }],
32
33 'react/jsx-filename-extension': ['error', { extensions: ['.js', '.tsx'] }],
34
35 'import/no-unresolved': 'off',
36 'no-shadow': 'off', // https://github.com/microsoft/fluent-ui-react/pull/1261#pullrequestreview-231005092
37 'no-unused-vars': 'off', // we use @typescript-eslint/no-unused-vars instead
38 // TODO: investigate and re-enable where appropriate
39 'import/extensions': 'off',
40
41 // Temporary disabled rules
42 'jsx-a11y/alt-text': 'off',
43 'jsx-a11y/anchor-is-valid': 'off',
44 'jsx-a11y/click-events-have-key-events': 'off',
45 'jsx-a11y/control-has-associated-label': 'off',
46 'jsx-a11y/label-has-associated-control': 'off',
47 'jsx-a11y/label-has-for': 'off',
48 'jsx-a11y/no-noninteractive-tabindex': 'off',
49 'jsx-a11y/no-static-element-interactions': 'off',
50 'import/export': 'off',
51 'import/first': 'off',
52 'import/no-dynamic-require': 'off',
53 'import/no-named-default': 'off',
54 'import/no-useless-path-segments': 'off',
55 'import/order': 'off',
56 'import/prefer-default-export': 'off',
57 'react/button-has-type': 'off',
58 'react/default-props-match-prop-types': 'off',
59 'react/destructuring-assignment': 'off',
60 'react/forbid-foreign-prop-types': 'off',
61 'react/forbid-prop-types': 'off',
62 'react/jsx-boolean-value': 'off',
63 'react/jsx-curly-brace-presence': 'off',
64 'react/jsx-no-bind': 'off',
65 'react/jsx-props-no-spreading': 'off',
66 'react/jsx-no-target-blank': 'off',
67 'react/jsx-pascal-case': 'off',
68 'react/no-access-state-in-setstate': 'off',
69 'react/no-array-index-key': 'off',
70 'react/no-children-prop': 'off',
71 'react/no-find-dom-node': 'off',
72 'react/no-multi-comp': 'off',
73 'react/no-render-return-value': 'off',
74 'react/no-string-refs': 'off',
75 'react/no-unescaped-entities': 'off',
76 'react/no-unused-prop-types': 'off',
77 'react/no-unused-state': 'off',
78 'react/prefer-stateless-function': 'off',
79 'react/prop-types': 'off',
80 'react/require-default-props': 'off',
81 'react/sort-comp': 'off',
82 'react/state-in-constructor': 'off',
83 'react/static-property-placement': 'off',
84 'arrow-body-style': 'off',
85 camelcase: 'off',
86 'class-methods-use-this': 'off',
87 'consistent-return': 'off',
88 'default-case': 'off',
89 'dot-notation': 'off',
90 'global-require': 'off',
91 'guard-for-in': 'off',
92 'lines-between-class-members': 'off',
93 'max-classes-per-file': 'off',
94 'no-await-in-loop': 'off',
95 'no-bitwise': 'off',
96 'no-case-declarations': 'off',
97 'no-continue': 'off',
98 'no-empty-function': 'off',
99 'no-empty': 'off',
100 'no-extra-boolean-cast': 'off',
101 'no-fallthrough': 'off',
102 'no-nested-ternary': 'off',
103 'no-param-reassign': 'off',
104 'no-plusplus': 'off',
105 'no-prototype-builtins': 'off',
106 'no-restricted-globals': 'off',
107 'no-restricted-properties': ['off', { object: 'Math', property: 'pow' }],
108 'no-restricted-syntax': 'off',
109 'no-return-assign': 'off',
110 'no-return-await': 'off',
111 'no-sparse-arrays': 'off',
112 'no-throw-literal': 'off',
113 'no-undef-init': 'off',
114 'no-undef': 'off',
115 'no-underscore-dangle': 'off',
116 'no-unused-expressions': 'off',
117 'no-use-before-define': 'off',
118 'no-useless-constructor': 'off',
119 'no-useless-escape': 'off',
120 'no-useless-return': 'off',
121 'operator-assignment': 'off',
122 'prefer-destructuring': 'off',
123 },
124 overrides: [
125 {
126 files: '**/jest.config.js',
127 rules: {
128 'global-require': 'off',
129 },
130 },
131 {
132 files: '**/test/**/*.{ts,tsx}',
133 rules: {
134 'import/no-extraneous-dependencies': 'off',
135 },
136 },
137 {
138 files: '**/examples/**/*.{ts,tsx}',
139 rules: {
140 'import/no-default-export': 'off',
141 },
142 },
143 {
144 files: '**/*.tsx',
145 rules: {
146 '@fluentui/no-visibility-modifiers': 'error',
147 },
148 },
149 {
150 files: '**/*.{ts,tsx}',
151 rules: {
152 'no-dupe-class-members': 'off',
153 },
154 },
155 ],
156 settings: {
157 'import/resolver': {
158 node: {
159 extensions: ['.js', '.jsx', '.ts', '.tsx'],
160 },
161 },
162 },
163};