@repodog/eslint-config 0.3.27 → 1.0.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.
package/README.md CHANGED
@@ -5,17 +5,29 @@ The RepoDog ESlint config.
5
5
  [![npm version](https://badge.fury.io/js/%40repodog%2Feslint-config.svg)](https://badge.fury.io/js/%40repodog%2Feslint-config)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
7
7
 
8
- ## Installation
8
+ ## Install package
9
9
 
10
10
  ```shell
11
- yarn add @repodog/eslint-config --dev
11
+ # terminal
12
+ npm install @repodog/eslint-config --save-dev
12
13
  ```
13
14
 
14
- ## Usage
15
+ ## Install dependencies
16
+
17
+ ```shell
18
+ # terminal
19
+ npm install @babel/eslint-parser @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint eslint-config-prettier eslint-import-resolver-typescript eslint-plugin-import eslint-plugin-jest eslint-plugin-jsx-a11y eslint-plugin-prettier eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-sort-class-members eslint-plugin-sort-destructure-keys eslint-plugin-sort-keys-fix eslint-plugin-typescript-sort-keys eslint-plugin-unicorn --save-dev
20
+ ```
21
+
22
+ ## Use package
15
23
 
16
24
  ```javascript
17
- // .eslintrc.js
25
+ // .eslintrc.cjs
18
26
  module.exports = {
19
- extends: ['@repodog/eslint-config', '@repodog/eslint-config/react']
27
+ extends: ['@repodog/eslint-config'],
28
+ parserOptions: {
29
+ tsconfigRootDir: __dirname,
30
+ },
31
+ root: true,
20
32
  };
21
33
  ```
package/index.cjs ADDED
@@ -0,0 +1,314 @@
1
+ module.exports = {
2
+ env: {
3
+ browser: true,
4
+ node: true,
5
+ },
6
+ extends: [
7
+ 'eslint:recommended',
8
+ 'plugin:import/recommended',
9
+ 'plugin:jsx-a11y/recommended',
10
+ 'plugin:react/recommended',
11
+ 'plugin:unicorn/recommended',
12
+ 'prettier',
13
+ ],
14
+ overrides: [
15
+ {
16
+ env: {
17
+ 'jest/globals': true,
18
+ },
19
+ extends: ['plugin:jest/recommended', 'plugin:jest/style'],
20
+ files: ['**/*.{spec,test}.*'],
21
+ plugins: ['jest'],
22
+ rules: {
23
+ 'jest/consistent-test-it': [
24
+ 2,
25
+ {
26
+ fn: 'it',
27
+ withinDescribe: 'it',
28
+ },
29
+ ],
30
+ 'jest/max-expects': [
31
+ 2,
32
+ {
33
+ max: 1,
34
+ },
35
+ ],
36
+ 'jest/max-nested-describe': [
37
+ 2,
38
+ {
39
+ max: 5,
40
+ },
41
+ ],
42
+ 'jest/no-conditional-in-test': 2,
43
+ 'jest/no-duplicate-hooks': 2,
44
+ 'jest/no-test-return-statement': 2,
45
+ 'jest/prefer-called-with': 2,
46
+ 'jest/prefer-comparison-matcher': 2,
47
+ 'jest/prefer-each': 2,
48
+ 'jest/prefer-equality-matcher': 2,
49
+ 'jest/prefer-expect-resolves': 2,
50
+ 'jest/prefer-hooks-in-order': 2,
51
+ 'jest/prefer-hooks-on-top': 2,
52
+ 'jest/prefer-todo': 2,
53
+ },
54
+ },
55
+ {
56
+ extends: [
57
+ 'plugin:@typescript-eslint/eslint-recommended',
58
+ 'plugin:@typescript-eslint/recommended',
59
+ 'plugin:@typescript-eslint/recommended-requiring-type-checking',
60
+ 'plugin:@typescript-eslint/strict',
61
+ 'plugin:import/typescript',
62
+ ],
63
+ files: ['**/*.{ts,tsx}'],
64
+ parser: '@typescript-eslint/parser',
65
+ parserOptions: {
66
+ project: ['./tsconfig.json'],
67
+ },
68
+ plugins: ['@typescript-eslint', 'typescript-sort-keys'],
69
+ rules: {
70
+ '@typescript-eslint/consistent-type-imports': [
71
+ 2,
72
+ {
73
+ disallowTypeAnnotations: false,
74
+ fixStyle: 'inline-type-imports',
75
+ prefer: 'type-imports',
76
+ },
77
+ ],
78
+ '@typescript-eslint/naming-convention': [
79
+ 2,
80
+ {
81
+ format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
82
+ selector: 'variable',
83
+ },
84
+ {
85
+ format: ['camelCase', 'PascalCase'],
86
+ selector: 'function',
87
+ },
88
+ {
89
+ format: ['PascalCase'],
90
+ selector: 'typeLike',
91
+ },
92
+ {
93
+ custom: {
94
+ match: false,
95
+ regex: '^I[A-Z]',
96
+ },
97
+ format: ['PascalCase'],
98
+ selector: 'interface',
99
+ },
100
+ {
101
+ custom: {
102
+ match: false,
103
+ regex: '^T[A-Z]',
104
+ },
105
+ format: ['PascalCase'],
106
+ selector: 'typeLike',
107
+ },
108
+ ],
109
+ '@typescript-eslint/no-non-null-assertion': 0,
110
+ '@typescript-eslint/no-unused-vars': [
111
+ 2,
112
+ { args: 'all', argsIgnorePattern: '^_', ignoreRestSiblings: true, vars: 'all' },
113
+ ],
114
+ '@typescript-eslint/no-use-before-define': [
115
+ 2,
116
+ { enums: true, functions: false, ignoreTypeReferences: true, typedefs: false },
117
+ ],
118
+ 'import/no-named-as-default': 0,
119
+ 'import/no-named-as-default-member': 0,
120
+ 'no-use-before-define': 0,
121
+ 'typescript-sort-keys/interface': 2,
122
+ 'typescript-sort-keys/string-enum': 2,
123
+ },
124
+ settings: {
125
+ 'import/resolver': {
126
+ typescript: {
127
+ alwaysTryTypes: true,
128
+ project: '<root>/tsconfig.json',
129
+ },
130
+ },
131
+ },
132
+ },
133
+ {
134
+ files: ['**/*.{mjs,cjs,js,jsx}'],
135
+ rules: {},
136
+ },
137
+ ],
138
+ parser: '@babel/eslint-parser',
139
+ parserOptions: {
140
+ ecmaFeatures: {
141
+ jsx: true,
142
+ },
143
+ },
144
+ plugins: [
145
+ 'import',
146
+ 'jsx-a11y',
147
+ 'react',
148
+ 'react-hooks',
149
+ 'sort-class-members',
150
+ 'sort-destructure-keys',
151
+ 'sort-keys-fix',
152
+ 'unicorn',
153
+ 'prettier',
154
+ ],
155
+ rules: {
156
+ 'import/extensions': [2, 'ignorePackages'],
157
+ 'import/namespace': 0,
158
+ 'import/no-default-export': 2,
159
+ // Outstanding bug impacting this rule: https://github.com/import-js/eslint-plugin-import/issues/2168
160
+ 'import/no-extraneous-dependencies': [
161
+ 2,
162
+ {
163
+ devDependencies: [
164
+ '**/.*',
165
+ '**/*.config.*',
166
+ '**/*.setup.*',
167
+ '**/*.test.*',
168
+ '**/*.stories.*',
169
+ '**/__testUtils__/**',
170
+ '**/__tests__/**',
171
+ '**/__mocks__/**',
172
+ '**/.storybook/**',
173
+ ],
174
+ peerDependencies: false,
175
+ },
176
+ ],
177
+ 'import/order': [
178
+ 2,
179
+ {
180
+ alphabetize: { caseInsensitive: false, order: 'asc' },
181
+ groups: [['builtin', 'external'], 'parent', 'sibling', 'index'],
182
+ 'newlines-between': 'never',
183
+ },
184
+ ],
185
+ 'max-len': [
186
+ 2,
187
+ {
188
+ code: 120,
189
+ comments: 100,
190
+ ignoreRegExpLiterals: true,
191
+ ignoreStrings: true,
192
+ ignoreTemplateLiterals: true,
193
+ ignoreUrls: true,
194
+ },
195
+ ],
196
+ 'no-unused-vars': [2, { args: 'all', argsIgnorePattern: '^_', ignoreRestSiblings: true, vars: 'all' }],
197
+ 'no-use-before-define': [2, { functions: false }],
198
+ 'one-var': [2, { initialized: 'never' }],
199
+ 'one-var-declaration-per-line': [2, 'initializations'],
200
+ 'padding-line-between-statements': [
201
+ 2,
202
+ { blankLine: 'any', next: '*', prev: '*' },
203
+ { blankLine: 'always', next: '*', prev: 'multiline-block-like' },
204
+ { blankLine: 'always', next: 'multiline-block-like', prev: '*' },
205
+ { blankLine: 'always', next: '*', prev: 'multiline-expression' },
206
+ { blankLine: 'always', next: 'multiline-expression', prev: '*' },
207
+ { blankLine: 'always', next: '*', prev: 'directive' },
208
+ { blankLine: 'always', next: 'directive', prev: '*' },
209
+ { blankLine: 'never', next: 'singleline-const', prev: 'singleline-const' },
210
+ { blankLine: 'never', next: 'singleline-const', prev: 'singleline-let' },
211
+ { blankLine: 'never', next: 'singleline-let', prev: 'singleline-let' },
212
+ { blankLine: 'never', next: 'singleline-let', prev: 'singleline-const' },
213
+ { blankLine: 'always', next: 'singleline-const', prev: 'cjs-import' },
214
+ { blankLine: 'always', next: 'singleline-let', prev: 'cjs-import' },
215
+ { blankLine: 'always', next: '*', prev: 'multiline-const' },
216
+ { blankLine: 'always', next: 'multiline-const', prev: '*' },
217
+ { blankLine: 'always', next: '*', prev: 'multiline-let' },
218
+ { blankLine: 'always', next: 'multiline-let', prev: '*' },
219
+ { blankLine: 'never', next: 'cjs-export', prev: 'cjs-export' },
220
+ { blankLine: 'never', next: 'cjs-import', prev: 'cjs-import' },
221
+ { blankLine: 'always', next: 'case', prev: '*' },
222
+ { blankLine: 'always', next: 'default', prev: '*' },
223
+ { blankLine: 'always', next: '*', prev: 'break' },
224
+ ],
225
+ 'prettier/prettier': 2,
226
+ 'react/jsx-filename-extension': [2, { extensions: ['.jsx', '.tsx'] }],
227
+ 'react/jsx-sort-props': [
228
+ 2,
229
+ {
230
+ callbacksLast: false,
231
+ ignoreCase: false,
232
+ noSortAlphabetically: false,
233
+ reservedFirst: false,
234
+ shorthandFirst: false,
235
+ shorthandLast: false,
236
+ },
237
+ ],
238
+ 'react/jsx-wrap-multilines': [
239
+ 2,
240
+ {
241
+ arrow: 'parens-new-line',
242
+ assignment: 'parens-new-line',
243
+ condition: 'parens-new-line',
244
+ declaration: 'parens-new-line',
245
+ logical: 'parens-new-line',
246
+ prop: 'ignore',
247
+ return: 'parens-new-line',
248
+ },
249
+ ],
250
+ 'react-hooks/exhaustive-deps': 2,
251
+ 'react-hooks/rules-of-hooks': 2,
252
+ 'sort-class-members/sort-class-members': [
253
+ 2,
254
+ {
255
+ accessorPairPositioning: 'getThenSet',
256
+ groups: {
257
+ 'arrow-function-properties': [
258
+ { propertyType: 'ArrowFunctionExpression', sort: 'alphabetical', type: 'property' },
259
+ ],
260
+ methods: [{ sort: 'alphabetical', type: 'method' }],
261
+ 'private-arrow-function-properties': [
262
+ { name: '/_.+/', propertyType: 'ArrowFunctionExpression', type: 'property' },
263
+ ],
264
+ 'private-methods': [{ name: '/_.+/', sort: 'alphabetical', type: 'method' }],
265
+ 'private-properties': [{ name: '/_.+/', sort: 'alphabetical', type: 'property' }],
266
+ properties: [{ sort: 'alphabetical', type: 'property' }],
267
+ 'static-methods': [{ sort: 'alphabetical', static: true, type: 'method' }],
268
+ 'static-private-methods': [{ name: '/_.+/', sort: 'alphabetical', static: true, type: 'method' }],
269
+ 'static-private-properties': [{ name: '/_.+/', sort: 'alphabetical', static: true, type: 'property' }],
270
+ 'static-properties': [{ sort: 'alphabetical', static: true, type: 'property' }],
271
+ },
272
+ order: [
273
+ '[static-properties]',
274
+ '[static-private-properties]',
275
+ '[static-methods]',
276
+ '[static-private-methods]',
277
+ '[arrow-function-properties]',
278
+ '[properties]',
279
+ '[private-arrow-function-properties]',
280
+ '[private-properties]',
281
+ 'constructor',
282
+ 'getters',
283
+ 'setters',
284
+ '[methods]',
285
+ '[private-methods]',
286
+ ],
287
+ },
288
+ ],
289
+ 'sort-destructure-keys/sort-destructure-keys': [2, { caseSensitive: true }],
290
+ 'sort-imports': [
291
+ 2,
292
+ {
293
+ ignoreDeclarationSort: true,
294
+ },
295
+ ],
296
+ 'sort-keys': 0,
297
+ 'sort-keys-fix/sort-keys-fix': [2, 'asc', { caseSensitive: true, natural: true }],
298
+ 'sort-vars': [2, { ignoreCase: false }],
299
+ 'unicorn/filename-case': [
300
+ 2,
301
+ {
302
+ cases: {
303
+ camelCase: true,
304
+ pascalCase: true,
305
+ },
306
+ },
307
+ ],
308
+ },
309
+ settings: {
310
+ react: {
311
+ version: '18',
312
+ },
313
+ },
314
+ };
package/package.json CHANGED
@@ -1,26 +1,37 @@
1
1
  {
2
2
  "name": "@repodog/eslint-config",
3
- "version": "0.3.27",
4
- "description": "The RepoDog eslint-config module.",
5
- "author": "Dylan Aubrey <dylanaubrey@gmail.com>",
3
+ "description": "The RepoDog ESLint config module.",
4
+ "version": "1.0.0",
5
+ "author": "Dylan Aubrey",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/badbatch/repodog",
8
- "bugs": {
9
- "url": "https://github.com/badbatch/repodog/issues"
10
- },
11
8
  "repository": {
9
+ "directory": "configs/eslint-config",
12
10
  "type": "git",
13
- "url": "https://github.com/badbatch/repodog"
11
+ "url": "https://github.com/badbatch/repodog/configs/eslint-config"
14
12
  },
13
+ "bugs": "https://github.com/badbatch/repodog/issues",
14
+ "main": "index.cjs",
15
15
  "publishConfig": {
16
16
  "access": "public"
17
17
  },
18
- "main": "index.js",
19
- "keywords": [
20
- "eslint",
21
- "configuration"
22
- ],
23
18
  "peerDependencies": {
24
- "prettier": "< 2"
19
+ "@babel/eslint-parser": "<8",
20
+ "@typescript-eslint/eslint-plugin": "<6",
21
+ "@typescript-eslint/parser": "<6",
22
+ "eslint": "<9",
23
+ "eslint-config-prettier": "<9",
24
+ "eslint-import-resolver-typescript": "<4",
25
+ "eslint-plugin-import": "<3",
26
+ "eslint-plugin-jest": "<28",
27
+ "eslint-plugin-jsx-a11y": "<7",
28
+ "eslint-plugin-prettier": "<5",
29
+ "eslint-plugin-react": "<8",
30
+ "eslint-plugin-react-hooks": "<5",
31
+ "eslint-plugin-sort-class-members": "<2",
32
+ "eslint-plugin-sort-destructure-keys": "<2",
33
+ "eslint-plugin-sort-keys-fix": "<2",
34
+ "eslint-plugin-typescript-sort-keys": "<3",
35
+ "eslint-plugin-unicorn": "<46"
25
36
  }
26
37
  }
package/dependencies.js DELETED
@@ -1,16 +0,0 @@
1
- const core = [
2
- 'babel-eslint',
3
- 'eslint',
4
- 'eslint-config-airbnb',
5
- 'eslint-config-prettier',
6
- 'eslint-plugin-import',
7
- 'eslint-plugin-prettier',
8
- 'eslint-plugin-sort-class-members',
9
- ];
10
-
11
- const react = ['eslint-plugin-jsx-a11y', 'eslint-plugin-react', 'eslint-plugin-react-hooks'];
12
-
13
- module.exports = {
14
- core,
15
- react,
16
- };
package/index.js DELETED
@@ -1,78 +0,0 @@
1
- module.exports = {
2
- env: {
3
- node: true,
4
- },
5
- extends: ['airbnb-base', 'eslint-config-prettier'],
6
- parser: 'babel-eslint',
7
- plugins: ['eslint-plugin-prettier', 'sort-class-members'],
8
- rules: {
9
- 'func-names': [2, 'always'],
10
- 'import/no-extraneous-dependencies': 0,
11
- 'max-len': [2, { code: 120, comments: 100, ignoreRegExpLiterals: true, ignoreUrls: true }],
12
- 'no-nested-ternary': 0,
13
- 'no-param-reassign': [2, { props: false }],
14
- 'no-underscore-dangle': 0,
15
- 'no-use-before-define': [2, { functions: false }],
16
- 'one-var': [2, { initialized: 'never' }],
17
- 'one-var-declaration-per-line': [2, 'initializations'],
18
- 'padding-line-between-statements': [
19
- 2,
20
- { blankLine: 'any', next: '*', prev: '*' },
21
- { blankLine: 'always', next: '*', prev: 'multiline-block-like' },
22
- { blankLine: 'always', next: 'multiline-block-like', prev: '*' },
23
- { blankLine: 'always', next: '*', prev: 'multiline-expression' },
24
- { blankLine: 'always', next: 'multiline-expression', prev: '*' },
25
- { blankLine: 'always', next: '*', prev: 'directive' },
26
- { blankLine: 'always', next: 'directive', prev: '*' },
27
- { blankLine: 'always', next: '*', prev: 'multiline-const' },
28
- { blankLine: 'always', next: 'multiline-const', prev: '*' },
29
- { blankLine: 'always', next: '*', prev: 'multiline-let' },
30
- { blankLine: 'always', next: 'multiline-let', prev: '*' },
31
- { blankLine: 'never', next: 'cjs-export', prev: 'cjs-export' },
32
- { blankLine: 'never', next: 'cjs-import', prev: 'cjs-import' },
33
- { blankLine: 'always', next: 'case', prev: '*' },
34
- { blankLine: 'always', next: 'default', prev: '*' },
35
- { blankLine: 'never', next: 'break', prev: '*' },
36
- ],
37
- 'prettier/prettier': [2],
38
- 'sort-class-members/sort-class-members': [
39
- 2,
40
- {
41
- accessorPairPositioning: 'getThenSet',
42
- groups: {
43
- 'arrow-function-properties': [
44
- { propertyType: 'ArrowFunctionExpression', sort: 'alphabetical', type: 'property' },
45
- ],
46
- methods: [{ sort: 'alphabetical', type: 'method' }],
47
- 'private-arrow-function-properties': [
48
- { name: '/_.+/', propertyType: 'ArrowFunctionExpression', type: 'property' },
49
- ],
50
- 'private-methods': [{ name: '/_.+/', sort: 'alphabetical', type: 'method' }],
51
- 'private-properties': [{ name: '/_.+/', sort: 'alphabetical', type: 'property' }],
52
- properties: [{ sort: 'alphabetical', type: 'property' }],
53
- 'static-methods': [{ sort: 'alphabetical', static: true, type: 'method' }],
54
- 'static-private-methods': [{ name: '/_.+/', sort: 'alphabetical', static: true, type: 'method' }],
55
- 'static-private-properties': [{ name: '/_.+/', sort: 'alphabetical', static: true, type: 'property' }],
56
- 'static-properties': [{ sort: 'alphabetical', static: true, type: 'property' }],
57
- },
58
- order: [
59
- '[static-properties]',
60
- '[static-private-properties]',
61
- '[static-methods]',
62
- '[static-private-methods]',
63
- '[arrow-function-properties]',
64
- '[properties]',
65
- '[private-arrow-function-properties]',
66
- '[private-properties]',
67
- 'constructor',
68
- 'getters',
69
- 'setters',
70
- '[methods]',
71
- '[private-methods]',
72
- ],
73
- },
74
- ],
75
- 'sort-keys': [2, 'asc', { caseSensitive: true, natural: true }],
76
- 'sort-vars': [2, { ignoreCase: false }],
77
- },
78
- };
package/react.js DELETED
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- extends: ['airbnb'],
3
- settings: {
4
- react: {
5
- version: 'detect',
6
- },
7
- },
8
- };