This repository was archived by the owner on Sep 13, 2024. It is now read-only.
forked from Belco90/octochangelog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.eslintrc.js
More file actions
118 lines (110 loc) · 2.83 KB
/
Copy path.eslintrc.js
File metadata and controls
118 lines (110 loc) · 2.83 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/* eslint-disable @typescript-eslint/no-var-requires */
const jestVersion = require('jest/package.json').version
module.exports = {
extends: [
'eslint:recommended',
'next/core-web-vitals',
'plugin:@typescript-eslint/recommended',
'prettier',
],
plugins: ['unicorn'],
settings: {
'import/internal-regex': '^(@app-|~)',
jest: {
version: jestVersion,
},
},
rules: {
// Base
'no-shadow': 'error',
'no-warning-comments': 'off',
'no-console': 'warn', // doesn't seem to be enabled in any preset
'no-restricted-imports': [
'error',
{
name: '@testing-library/react',
message: 'Please import from `test-utils` instead.',
},
],
// React
'react/self-closing-comp': 'error',
'react/react-in-jsx-scope': 'off',
'react/jsx-boolean-value': 'error',
'react/no-unknown-property': 'off', // started to report many weird errors recently
// Import
'import/newline-after-import': 'error',
'import/order': [
'error',
{
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: false,
},
},
],
// Unicorn
'unicorn/no-for-loop': 'error',
'unicorn/no-array-for-each': 'error',
'unicorn/no-array-reduce': 'error',
},
overrides: [
// TypeScript
{
files: ['**/*.ts?(x)'],
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.eslint.json'],
},
/*
* Linting with Type Information only for TS files:
* https://typescript-eslint.io/docs/linting/typed-linting/#i-get-errors-telling-me-the-file-must-be-included-in-at-least-one-of-the-projects-provided
*/
extends: [
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:@typescript-eslint/strict',
],
rules: {
'@typescript-eslint/array-type': [
'warn',
{
default: 'generic',
},
],
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
// Disabling because of index errors on interfaces,
// which works fine in type aliases:
// https://bobbyhadz.com/blog/typescript-index-signature-for-type-is-missing-in-type
'@typescript-eslint/consistent-type-definitions': 'off',
// Disabling because it's too strict:
// we are interested in using || operator multiple times to avoid empty strings.
'@typescript-eslint/prefer-nullish-coalescing': 'off',
},
},
// Jest
{
files: [
'src/**/__tests__/**/*.[jt]s?(x)',
'src/**/?(*.)+(spec|test).[jt]s?(x)',
'src/setup-tests.ts',
],
extends: [
'plugin:jest/recommended',
'plugin:jest/style',
'plugin:jest-formatting/recommended',
],
rules: {
'jest/consistent-test-it': 'warn',
},
},
// Cypress
{
files: ['cypress/**/*.[jt]s'],
extends: ['plugin:cypress/recommended'],
rules: {
'jest/no-focused-tests': 'error',
},
},
],
}