@viclafouch/eslint-config-viclafouch 3.9.1 → 3.9.3-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @type {import("eslint").Linter.Config}
3
+ */
4
+ module.exports = {
5
+ rules: {
6
+ // enforce or disallow variable initializations at definition
7
+ 'init-declarations': 'off',
8
+
9
+ // disallow the catch clause parameter name being the same as a variable in the outer scope
10
+ 'no-catch-shadow': 'off',
11
+
12
+ // disallow deletion of variables
13
+ 'no-delete-var': 'error',
14
+
15
+ // disallow labels that share a name with a variable
16
+ // https://eslint.org/docs/rules/no-label-var
17
+ 'no-label-var': 'error',
18
+
19
+ // disallow declaration of variables already declared in the outer scope
20
+ 'no-shadow': 'error',
21
+
22
+ // For code readability, prevent creating unclear naming
23
+ 'id-length': [
24
+ 'error',
25
+ { min: 2, max: Infinity, exceptions: ['t', '_'], properties: 'never' }
26
+ ],
27
+
28
+ // Require the second parameter when using `parseInt`.
29
+ // Ref: https://eslint.org/docs/rules/radix
30
+ radix: 2,
31
+
32
+ // Prefer object shorthands for properties.
33
+ // Ref: https://eslint.org/docs/rules/object-shorthand
34
+ 'object-shorthand': [2, 'properties'],
35
+
36
+ // disallow shadowing of names such as arguments
37
+ 'no-shadow-restricted-names': 'error',
38
+
39
+ // disallow use of undeclared variables unless mentioned in a /*global */ block
40
+ 'no-undef': 'error',
41
+
42
+ // disallow use of undefined when initializing variables
43
+ 'no-undef-init': 'error',
44
+
45
+ // Most common naming that is not always understandable
46
+ 'id-denylist': [
47
+ 'error',
48
+ 'err',
49
+ 'cb',
50
+ 'arr',
51
+ 'acc',
52
+ 'idx',
53
+ 'ctx',
54
+ 'res',
55
+ 'val',
56
+ 'obj',
57
+ 'el',
58
+ 'elem',
59
+ 'req'
60
+ ],
61
+
62
+ // disallow declaration of variables that are not used in the code
63
+ 'no-unused-vars': [
64
+ 'error',
65
+ { vars: 'all', args: 'after-used', ignoreRestSiblings: true }
66
+ ],
67
+
68
+ // disallow use of variables before they are defined
69
+ 'no-use-before-define': [
70
+ 'error',
71
+ { functions: true, classes: true, variables: true }
72
+ ]
73
+ }
74
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "esnext",
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "allowJs": true,
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "forceConsistentCasingInFileNames": true,
9
+ "noEmit": true,
10
+ "esModuleInterop": true,
11
+ "module": "esnext",
12
+ "noUncheckedIndexedAccess": true,
13
+ "noPropertyAccessFromIndexSignature": true,
14
+ "moduleResolution": "node",
15
+ "resolveJsonModule": true,
16
+ "isolatedModules": true,
17
+ "noImplicitAny": true,
18
+ "jsx": "preserve",
19
+ "incremental": true
20
+ }
21
+ }
package/.eslintrc-base.js DELETED
@@ -1,138 +0,0 @@
1
- module.exports = {
2
- plugins: ['react', 'simple-import-sort', 'promise'],
3
- env: {
4
- browser: true,
5
- es6: true,
6
- node: true
7
- },
8
- settings: {
9
- react: {
10
- version: 'detect'
11
- }
12
- },
13
- rules: {
14
- 'id-length': [
15
- 'error',
16
- { min: 2, max: Infinity, exceptions: ['t', '_'], properties: 'never' }
17
- ],
18
- 'react/jsx-no-leaked-render': [2, { validStrategies: ['ternary'] }],
19
- 'id-denylist': [
20
- 'error',
21
- 'err',
22
- 'cb',
23
- 'arr',
24
- 'acc',
25
- 'idx',
26
- 'ctx',
27
- 'res',
28
- 'val',
29
- 'obj',
30
- 'src',
31
- 'el',
32
- 'elem',
33
- 'req'
34
- ],
35
- 'react/prop-types': 'off',
36
- 'simple-import-sort/imports': 'error',
37
- 'react/jsx-props-no-spreading': 0,
38
- 'no-return-await': 2,
39
- 'import/prefer-default-export': 0,
40
- 'react/jsx-boolean-value': 2,
41
- 'react/self-closing-comp': 2,
42
- 'react/hook-use-state': 2,
43
- 'react/default-props-match-prop-types': 2,
44
- 'react/no-unused-prop-types': 2,
45
- 'react/no-unused-prop-types': 2,
46
- 'promise/prefer-await-to-then': 2,
47
- 'require-await': 2,
48
- 'react/sort-prop-types': [
49
- 2,
50
- {
51
- requiredFirst: true,
52
- callbacksLast: true,
53
- sortShapeProp: true
54
- }
55
- ],
56
- curly: 2,
57
- 'arrow-body-style': ['error', 'always'],
58
- 'no-restricted-syntax': [
59
- 'error',
60
- {
61
- selector:
62
- "JSXElement > JSXExpressionContainer > LogicalExpression[operator!='??']",
63
- message: 'Please use ternary operator instead'
64
- }
65
- ],
66
- 'react/function-component-definition': [
67
- 2,
68
- { namedComponents: 'arrow-function' }
69
- ],
70
- // Prefer to have a convention for naming states
71
- // e.g: [thing, setThing]
72
- 'react/hook-use-state': 2,
73
-
74
- // Prevent the boolean true as prop value
75
- // e.g: <MyComponent isValid /> instead of <MyComponent isValid={true} />
76
- 'react/jsx-boolean-value': 2,
77
-
78
- // defaultProps is deprecated
79
- 'react/require-default-props': [
80
- 'error',
81
- {
82
- functions: 'defaultArguments'
83
- }
84
- ],
85
- 'prettier/prettier': [
86
- 'error',
87
- {
88
- semi: false,
89
- singleQuote: true,
90
- printWidth: 80,
91
- tabWidth: 2,
92
- jsxSingleQuote: false,
93
- trailingComma: 'none',
94
- endOfLine: 'auto',
95
- bracketSameLine: false,
96
- arrowParens: 'always'
97
- }
98
- ]
99
- },
100
- overrides: [
101
- {
102
- files: ['*.jsx', '*.js', '*.ts', '*.tsx'],
103
- rules: {
104
- 'simple-import-sort/imports': [
105
- 'error',
106
- {
107
- groups: [
108
- [
109
- // Anything that starts with react
110
- // e.g: import { useState } from 'react'
111
- // e.g: import { useFela } from 'react-fela'
112
- '^react',
113
- // Anything that starts with next
114
- // e.g: import { useRouter } from 'next/router'
115
- '^next',
116
- // Anything that starts with a letter
117
- // e.g: import Downshift from 'downshift'
118
- '^[a-z]',
119
- // Anything that starts with @
120
- // e.g: import { yupResolver } from '@hookform/resolvers/yup'
121
- '^@',
122
- // Anything that starts with a dot
123
- // e.g: import { matchIsDate } from './utils/date
124
- '^\\.',
125
- // Side effect imports from lib
126
- // e.g: import 'react-toastify/dist/ReactToastify.css'
127
- '^\\u0000',
128
- // Side effect import that starts with a dot
129
- // e.g: import './setup-config'
130
- '^\\u0000\\.'
131
- ]
132
- ]
133
- }
134
- ]
135
- }
136
- }
137
- ]
138
- }
package/.eslintrc.js DELETED
@@ -1,17 +0,0 @@
1
- module.exports = {
2
- extends: [
3
- 'airbnb',
4
- 'airbnb/hooks',
5
- 'plugin:prettier/recommended',
6
- './.eslintrc-base.js'
7
- ],
8
- parser: '@babel/eslint-parser',
9
- parserOptions: {
10
- requireConfigFile: false,
11
- ecmaVersion: 'latest',
12
- sourceType: 'module',
13
- ecmaFeatures: {
14
- jsx: true
15
- }
16
- }
17
- }
package/typescript.js DELETED
@@ -1,17 +0,0 @@
1
- module.exports = {
2
- extends: [
3
- 'airbnb',
4
- 'airbnb-typescript',
5
- 'airbnb/hooks',
6
- 'plugin:@typescript-eslint/recommended',
7
- 'plugin:@typescript-eslint/recommended-requiring-type-checking',
8
- 'plugin:prettier/recommended',
9
- './.eslintrc-base.js'
10
- ],
11
- parser: '@typescript-eslint/parser',
12
- plugins: ['react', '@typescript-eslint', 'simple-import-sort'],
13
- rules: {
14
- '@typescript-eslint/ban-ts-comment': 'off',
15
- 'react/jsx-filename-extension': [1, { extensions: ['.ts', '.tsx'] }]
16
- }
17
- }