UNPKG

3.67 kBJavaScriptView Raw
1module.exports = {
2 root: true,
3 extends: [
4 'airbnb',
5 'airbnb/hooks',
6 'plugin:prettier/recommended',
7 'prettier/react',
8 'plugin:cypress/recommended',
9 ],
10 parser: 'babel-eslint',
11 parserOptions: {
12 ecmaVersion: 2018,
13 sourceType: 'module',
14 ecmaFeatures: {
15 jsx: true,
16 },
17 },
18 settings: {
19 react: {
20 version: 'detect',
21 },
22 'import/resolver': {
23 node: {
24 extensions: ['.js', '.jsx', '.ts', '.tsx'],
25 },
26 },
27 },
28 env: {
29 browser: true,
30 commonjs: true,
31 es6: true,
32 jest: true,
33 node: true,
34 },
35 overrides: [
36 {
37 files: ['**/*.ts?(x)'],
38 extends: [
39 'plugin:@typescript-eslint/eslint-recommended',
40 'prettier/@typescript-eslint',
41 'plugin:import/typescript',
42 ],
43 parser: '@typescript-eslint/parser',
44 parserOptions: {
45 warnOnUnsupportedTypeScriptVersion: true,
46 },
47 rules: {
48 // APIs are not camelCase
49 '@typescript-eslint/camelcase': 'off',
50 camelcase: 'off',
51 // Use TypeScript types instead
52 'react/prop-types': 'off',
53 // Fixes definition files imports
54 'spaced-comment': ['error', 'always', { markers: ['/'] }],
55 'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }],
56 'no-unused-vars': 'off',
57 },
58 },
59 ],
60 rules: {
61 // START :: DO NOT TOUCH THESE, these need to be in sync with `core-prettier`
62 'prettier/prettier': 'error',
63 curly: ['error', 'all'],
64 'lines-around-comment': [
65 'error',
66 {
67 // https://github.com/typescript-eslint/typescript-eslint/issues/1150
68 beforeBlockComment: false,
69 afterBlockComment: false,
70 // https://github.com/typescript-eslint/typescript-eslint/issues/1150
71 beforeLineComment: false,
72 afterLineComment: false,
73 allowBlockStart: true,
74 allowBlockEnd: false,
75 allowObjectStart: true,
76 allowObjectEnd: false,
77 allowArrayStart: true,
78 allowArrayEnd: false,
79 allowClassStart: true,
80 allowClassEnd: false,
81 },
82 ],
83 'max-len': [
84 'warn',
85 {
86 code: 80,
87 ignoreUrls: true,
88 ignoreStrings: true,
89 ignoreTemplateLiterals: true,
90 ignoreTrailingComments: true,
91 },
92 ],
93 'no-confusing-arrow': ['error', { allowParens: true }],
94 'no-mixed-operators': 'error',
95 'no-tabs': 'error',
96 'no-unexpected-multiline': 'error',
97 quotes: [
98 'error',
99 'single',
100 { avoidEscape: true, allowTemplateLiterals: false },
101 ],
102 // END :: DO NOT TOUCH THESE, these need to be in sync with `core-prettier`
103 'import/prefer-default-export': 'off',
104 'react/destructuring-assignment': ['error', 'never'],
105 'import/no-extraneous-dependencies': [
106 'error',
107 {
108 devDependencies: [
109 '**/*.@(spec|test|story).@(js|jsx|ts|tsx)',
110 '**/__tests__/**',
111 ],
112 },
113 ],
114 'no-param-reassign': [
115 'error',
116 { props: true, ignorePropertyModificationsFor: ['self'] },
117 ],
118 'react/jsx-props-no-spreading': 'off',
119 'react/jsx-fragments': ['error', 'element'],
120 'import/no-unresolved': 'off',
121 'import/extensions': [
122 'error',
123 'ignorePackages',
124 {
125 js: 'never',
126 mjs: 'never',
127 jsx: 'never',
128 tsx: 'never',
129 ts: 'never',
130 },
131 ],
132 'react-hooks/exhaustive-deps': 'off',
133 'no-use-before-define': ['error', { functions: false }],
134 'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
135 'no-unused-expressions': ['error', { allowShortCircuit: true }],
136 },
137}