-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
55 lines (53 loc) · 1.81 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
const fs = require('fs');
const path = require('path');
const prettierOptions = JSON.parse(
fs.readFileSync(path.resolve(__dirname, '.prettierrc'), 'utf8'),
);
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'prettier', // -> [eslint-config-prettier]
'eslint:recommended', // -> [eslint]
'plugin:json/recommended', // -> [eslint-plugin-json]
'plugin:@typescript-eslint/recommended', // [typescript eslint rules..]
'plugin:prettier/recommended', // [typescript eslint rules..]
],
root: true,
env: {
node: true,
jest: true,
},
plugins: ['@typescript-eslint', 'prettier', 'import'],
ignorePatterns: ['.eslintrc.js'],
rules: {
'prettier/prettier': ['error', prettierOptions], // Enhance prettier with custom options
'@typescript-eslint/explicit-function-return-type': ['error'], // Explicit types for function return
'@typescript-eslint/no-empty-function': 'off', // Disable this rule to make empty function for testing case or default props
'@typescript-eslint/no-var-requires': 'off', // Disable this rule to enable ES5 imports (const something = require('something');)
'@typescript-eslint/no-use-before-define': ['error', { typedefs: false }],
'import/order': [
2,
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
],
'newlines-between': 'always',
alphabetize: {
order:
'asc' /* sort in ascending order. Options: ['ignore', 'asc', 'desc'] */,
caseInsensitive: true /* ignore case. Options: [true, false] */,
},
},
],
},
};