-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
72 lines (65 loc) · 2.07 KB
/
index.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
// Splitting rules into separate modules allow for a lower-level API if our
// default rules become difficult to extend without lots of duplication.
const coreRules = require('./rules/core');
const importRules = require('./rules/import');
const typescriptRules = require('./rules/typescript');
const importSettings = require('./settings/import');
/**
* @see https://github.com/eslint/eslint/issues/3458
* @see https://www.npmjs.com/package/@rushstack/eslint-patch
*/
require('@rushstack/eslint-patch/modern-module-resolution');
const OFF = 0;
// const WARN = 1;
// const ERROR = 2;
/** @type {import('eslint').Linter.Config} */
const config = {
parser: '@babel/eslint-parser',
parserOptions: {
sourceType: 'module',
requireConfigFile: false,
ecmaVersion: 'latest',
babelOptions: {
presets: [require.resolve('@babel/preset-react')],
},
},
plugins: ['import'],
settings: {
...importSettings,
},
// NOTE: In general - we want to use prettier for the majority of stylistic
// concerns. However there are some "stylistic" eslint rules we use that should
// not fail a PR since we can auto-fix them after merging to dev. These rules
// should be set to WARN.
//
// ERROR should be used for "functional" rules that indicate a problem in the
// code, and these will cause a PR failure
// IMPORTANT: Ensure that rules used here are compatible with
// typescript-eslint. If they are not, we need to turn the rule off in our
// overrides for ts/tsx.
// To read the details for any rule, see https://eslint.org/docs/rules/[RULE-KEY]
rules: {
...coreRules,
...importRules,
},
overrides: [
{
files: ['**/*.ts?(x)'],
extends: ['plugin:import/typescript'],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 2019,
ecmaFeatures: {
jsx: true,
},
warnOnUnsupportedTypeScriptVersion: true,
},
plugins: ['@typescript-eslint'],
rules: {
...typescriptRules,
},
},
],
};
module.exports = config;