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