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