eslint-config-conventions 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.
@@ -0,0 +1 @@
1
+ { "extends": ["@commitlint/config-conventional"] }
package/.editorconfig ADDED
@@ -0,0 +1,11 @@
1
+ # For more information see: https://editorconfig.org/
2
+
3
+ root = true
4
+
5
+ [*]
6
+ indent_style = space
7
+ indent_size = 2
8
+ end_of_line = lf
9
+ charset = utf-8
10
+ trim_trailing_whitespace = true
11
+ insert_final_newline = true
package/.eslintignore ADDED
@@ -0,0 +1,2 @@
1
+ node_modules
2
+ test/fixtures
package/.eslintrc.json ADDED
@@ -0,0 +1,318 @@
1
+ {
2
+ "root": true,
3
+ "plugins": ["@typescript-eslint", "import", "promise", "unicorn"],
4
+ "env": {
5
+ "browser": true,
6
+ "node": true,
7
+ "es2022": true
8
+ },
9
+ "parser": "@typescript-eslint/parser",
10
+ "parserOptions": {
11
+ "ecmaVersion": 2022,
12
+ "sourceType": "module",
13
+ "ecmaFeatures": {
14
+ "jsx": true
15
+ },
16
+ "project": "./tsconfig.json"
17
+ },
18
+ "rules": {
19
+ "constructor-super": "error",
20
+ "for-direction": "error",
21
+ "getter-return": "error",
22
+ "no-async-promise-executor": "error",
23
+ "no-class-assign": "error",
24
+ "no-compare-neg-zero": "error",
25
+ "no-cond-assign": "error",
26
+ "no-const-assign": "error",
27
+ "no-constant-condition": "error",
28
+ "no-constructor-return": "error",
29
+ "no-control-regex": "error",
30
+ "no-debugger": "error",
31
+ "no-dupe-args": "error",
32
+ "no-dupe-class-members": "off",
33
+ "@typescript-eslint/no-dupe-class-members": "error",
34
+ "no-dupe-else-if": "error",
35
+ "no-dupe-keys": "error",
36
+ "no-duplicate-case": "error",
37
+ "no-duplicate-imports": "off",
38
+ "@typescript-eslint/no-duplicate-imports": "error",
39
+ "no-empty-character-class": "error",
40
+ "no-empty-pattern": "error",
41
+ "no-ex-assign": "error",
42
+ "no-fallthrough": "error",
43
+ "no-func-assign": "error",
44
+ "no-import-assign": "error",
45
+ "no-invalid-regexp": "error",
46
+ "no-irregular-whitespace": "error",
47
+ "no-loss-of-precision": "off",
48
+ "@typescript-eslint/no-loss-of-precision": "error",
49
+ "no-misleading-character-class": "error",
50
+ "no-new-symbol": "error",
51
+ "no-obj-calls": "error",
52
+ "no-promise-executor-return": "error",
53
+ "no-prototype-builtins": "error",
54
+ "no-self-assign": "error",
55
+ "no-self-compare": "error",
56
+ "no-setter-return": "error",
57
+ "no-this-before-super": "error",
58
+ "no-undef": "error",
59
+ "no-unexpected-multiline": "error",
60
+ "no-unmodified-loop-condition": "error",
61
+ "no-unreachable": "error",
62
+ "no-unreachable-loop": "error",
63
+ "no-unsafe-finally": "error",
64
+ "no-unsafe-negation": "error",
65
+ "no-unsafe-optional-chaining": "error",
66
+ "no-unused-private-class-members": "error",
67
+ "no-unused-vars": "off",
68
+ "@typescript-eslint/no-unused-vars": "error",
69
+ "no-use-before-define": "off",
70
+ "@typescript-eslint/no-use-before-define": [
71
+ "error",
72
+ {
73
+ "functions": false,
74
+ "classes": false,
75
+ "enums": false,
76
+ "variables": false,
77
+ "typedefs": false
78
+ }
79
+ ],
80
+ "no-useless-backreference": "error",
81
+ "require-atomic-updates": "error",
82
+ "use-isnan": [
83
+ "error",
84
+ {
85
+ "enforceForSwitchCase": true,
86
+ "enforceForIndexOf": true
87
+ }
88
+ ],
89
+ "valid-typeof": ["error", { "requireStringLiterals": true }],
90
+
91
+ "class-methods-use-this": "error",
92
+ "consistent-this": "error",
93
+ "default-param-last": "off",
94
+ "@typescript-eslint/default-param-last": "error",
95
+ "default-case-last": "error",
96
+ "dot-notation": "off",
97
+ "@typescript-eslint/dot-notation": ["error", { "allowKeywords": true }],
98
+ "eqeqeq": "error",
99
+ "grouped-accessor-pairs": "error",
100
+ "new-cap": [
101
+ "error",
102
+ { "newIsCap": true, "capIsNew": false, "properties": true }
103
+ ],
104
+ "no-array-constructor": "off",
105
+ "@typescript-eslint/no-array-constructor": "error",
106
+ "no-caller": "error",
107
+ "no-confusing-arrow": "error",
108
+ "no-delete-var": "error",
109
+ "no-empty": ["error", { "allowEmptyCatch": true }],
110
+ "no-eval": "error",
111
+ "no-floating-decimal": "error",
112
+ "no-global-assign": "error",
113
+ "no-implied-eval": "off",
114
+ "@typescript-eslint/no-implied-eval": "error",
115
+ "no-mixed-operators": [
116
+ "error",
117
+ {
118
+ "groups": [
119
+ ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
120
+ ["&&", "||"],
121
+ ["in", "instanceof"]
122
+ ],
123
+ "allowSamePrecedence": true
124
+ }
125
+ ],
126
+ "no-multi-str": "error",
127
+ "no-new-func": "error",
128
+ "no-new-object": "error",
129
+ "no-octal": "error",
130
+ "no-octal-escape": "error",
131
+ "no-proto": "error",
132
+ "no-redeclare": "off",
133
+ "@typescript-eslint/no-redeclare": ["error", { "builtinGlobals": false }],
134
+ "no-regex-spaces": "error",
135
+ "no-shadow-restricted-names": "error",
136
+ "no-throw-literal": "off",
137
+ "@typescript-eslint/no-throw-literal": "error",
138
+ "no-undef-init": "error",
139
+ "no-unused-expressions": "off",
140
+ "@typescript-eslint/no-unused-expressions": [
141
+ "error",
142
+ {
143
+ "allowShortCircuit": true,
144
+ "allowTernary": true,
145
+ "allowTaggedTemplates": true
146
+ }
147
+ ],
148
+ "no-useless-call": "error",
149
+ "no-useless-computed-key": "error",
150
+ "no-useless-constructor": "off",
151
+ "@typescript-eslint/no-useless-constructor": "error",
152
+ "no-useless-escape": "error",
153
+ "no-useless-rename": "error",
154
+ "no-useless-return": "error",
155
+ "no-var": "error",
156
+ "no-void": "error",
157
+ "no-with": "error",
158
+ "object-shorthand": ["error", "properties"],
159
+ "one-var": ["error", { "initialized": "never" }],
160
+ "prefer-const": ["error", { "destructuring": "all" }],
161
+ "prefer-object-has-own": "error",
162
+ "prefer-promise-reject-errors": "error",
163
+ "prefer-regex-literals": ["error", { "disallowRedundantWrapping": true }],
164
+ "quote-props": ["error", "as-needed"],
165
+ "radix": "error",
166
+ "require-await": "off",
167
+ "@typescript-eslint/require-await": "error",
168
+ "spaced-comment": ["error", "always"],
169
+ "yoda": ["error", "never"],
170
+
171
+ "import/no-absolute-path": "error",
172
+ "import/no-webpack-loader-syntax": "error",
173
+ "import/no-self-import": "error",
174
+ "import/no-useless-path-segments": "error",
175
+ "import/export": "error",
176
+ "import/first": "error",
177
+ "import/no-duplicates": "error",
178
+ "import/order": [
179
+ "error",
180
+ {
181
+ "groups": ["builtin", "external", "internal"],
182
+ "newlines-between": "always"
183
+ }
184
+ ],
185
+ "import/no-named-default": "error",
186
+
187
+ "promise/param-names": "error",
188
+ "promise/no-new-statics": "error",
189
+
190
+ "unicorn/better-regex": "error",
191
+ "unicorn/catch-error-name": "error",
192
+ "unicorn/custom-error-definition": "error",
193
+ "unicorn/error-message": "error",
194
+ "unicorn/escape-case": "error",
195
+ "unicorn/new-for-builtins": "error",
196
+ "unicorn/no-array-callback-reference": "error",
197
+ "unicorn/no-hex-escape": "error",
198
+ "unicorn/no-instanceof-array": "error",
199
+ "unicorn/no-this-assignment": "error",
200
+ "unicorn/no-zero-fractions": "error",
201
+ "unicorn/prefer-node-protocol": "error",
202
+ "unicorn/throw-new-error": "error"
203
+ },
204
+ "overrides": [
205
+ {
206
+ "files": ["*.ts", "*.tsx"],
207
+ "rules": {
208
+ "@typescript-eslint/adjacent-overload-signatures": "error",
209
+ "@typescript-eslint/array-type": [
210
+ "error",
211
+ { "default": "array-simple" }
212
+ ],
213
+ "@typescript-eslint/consistent-type-assertions": [
214
+ "error",
215
+ {
216
+ "assertionStyle": "as",
217
+ "objectLiteralTypeAssertions": "never"
218
+ }
219
+ ],
220
+ "@typescript-eslint/consistent-type-definitions": [
221
+ "error",
222
+ "interface"
223
+ ],
224
+ "@typescript-eslint/explicit-function-return-type": [
225
+ "error",
226
+ {
227
+ "allowExpressions": true,
228
+ "allowHigherOrderFunctions": true,
229
+ "allowTypedFunctionExpressions": true,
230
+ "allowDirectConstAssertionInArrowFunctions": true
231
+ }
232
+ ],
233
+ "@typescript-eslint/member-delimiter-style": [
234
+ "error",
235
+ {
236
+ "multiline": { "delimiter": "none" },
237
+ "singleline": { "delimiter": "comma", "requireLast": false }
238
+ }
239
+ ],
240
+ "@typescript-eslint/method-signature-style": "error",
241
+ "@typescript-eslint/naming-convention": [
242
+ "error",
243
+ {
244
+ "selector": "variableLike",
245
+ "leadingUnderscore": "allow",
246
+ "trailingUnderscore": "allow",
247
+ "format": ["camelCase", "PascalCase", "UPPER_CASE"]
248
+ }
249
+ ],
250
+ "@typescript-eslint/no-base-to-string": "error",
251
+ "@typescript-eslint/no-dynamic-delete": "error",
252
+ "@typescript-eslint/no-empty-interface": [
253
+ "error",
254
+ { "allowSingleExtends": true }
255
+ ],
256
+ "@typescript-eslint/no-extra-non-null-assertion": "error",
257
+ "@typescript-eslint/no-extraneous-class": [
258
+ "error",
259
+ { "allowWithDecorator": true }
260
+ ],
261
+ "@typescript-eslint/no-floating-promises": "error",
262
+ "@typescript-eslint/no-for-in-array": "error",
263
+ "@typescript-eslint/no-invalid-void-type": "error",
264
+ "@typescript-eslint/no-misused-new": "error",
265
+ "@typescript-eslint/no-misused-promises": "error",
266
+ "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
267
+ "@typescript-eslint/no-non-null-assertion": "error",
268
+ "@typescript-eslint/no-this-alias": [
269
+ "error",
270
+ { "allowDestructuring": true }
271
+ ],
272
+ "@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
273
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
274
+ "@typescript-eslint/no-var-requires": "error",
275
+ "@typescript-eslint/prefer-function-type": "error",
276
+ "@typescript-eslint/prefer-includes": "error",
277
+ "@typescript-eslint/prefer-nullish-coalescing": [
278
+ "error",
279
+ {
280
+ "ignoreConditionalTests": false,
281
+ "ignoreMixedLogicalExpressions": false
282
+ }
283
+ ],
284
+ "@typescript-eslint/prefer-optional-chain": "error",
285
+ "@typescript-eslint/prefer-readonly": "error",
286
+ "@typescript-eslint/prefer-reduce-type-parameter": "error",
287
+ "@typescript-eslint/prefer-ts-expect-error": "error",
288
+ "@typescript-eslint/promise-function-async": "error",
289
+ "@typescript-eslint/require-array-sort-compare": [
290
+ "error",
291
+ { "ignoreStringArrays": true }
292
+ ],
293
+ "@typescript-eslint/restrict-plus-operands": [
294
+ "error",
295
+ { "checkCompoundAssignments": true }
296
+ ],
297
+ "@typescript-eslint/restrict-template-expressions": [
298
+ "error",
299
+ { "allowNumber": true }
300
+ ],
301
+ "@typescript-eslint/return-await": ["error", "always"],
302
+ "@typescript-eslint/strict-boolean-expressions": [
303
+ "error",
304
+ {
305
+ "allowString": false,
306
+ "allowNumber": false,
307
+ "allowNullableObject": false,
308
+ "allowNullableBoolean": false,
309
+ "allowNullableString": false,
310
+ "allowNullableNumber": false,
311
+ "allowAny": false
312
+ }
313
+ ],
314
+ "@typescript-eslint/type-annotation-spacing": "error"
315
+ }
316
+ }
317
+ ]
318
+ }
package/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ * text=auto eol=lf
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: '🐛 Bug Report'
3
+ about: 'Report an unexpected problem or unintended behavior.'
4
+ title: '[Bug]'
5
+ labels: 'bug'
6
+ ---
7
+
8
+ <!--
9
+ Please provide a clear and concise description of what the bug is. Include
10
+ screenshots if needed. Please make sure your issue has not already been fixed.
11
+ -->
12
+
13
+ ## Steps To Reproduce
14
+
15
+ 1. Step 1
16
+ 2. Step 2
17
+
18
+ ## The current behavior
19
+
20
+ ## The expected behavior
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: '📜 Documentation'
3
+ about: 'Correct spelling errors, improvements or additions to documentation files (README, CONTRIBUTING...).'
4
+ title: '[Documentation]'
5
+ labels: 'documentation'
6
+ ---
7
+
8
+ <!-- Please make sure your issue has not already been fixed. -->
9
+
10
+ ## Documentation
11
+
12
+ <!-- Please uncomment the type of documentation problem this issue address -->
13
+
14
+ <!-- Documentation is Missing -->
15
+ <!-- Documentation is Confusing -->
16
+ <!-- Documentation has Typo errors -->
17
+
18
+ ## Proposal
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: '✨ Feature Request'
3
+ about: 'Suggest a new feature idea.'
4
+ title: '[Feature]'
5
+ labels: 'feature request'
6
+ ---
7
+
8
+ <!-- Please make sure your issue has not already been fixed. -->
9
+
10
+ ## Description
11
+
12
+ <!-- A clear and concise description of the problem or missing capability... -->
13
+
14
+ ## Describe the solution you'd like
15
+
16
+ <!-- If you have a solution in mind, please describe it. -->
17
+
18
+ ## Describe alternatives you've considered
19
+
20
+ <!-- Have you considered any alternative solutions or workarounds? -->
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: '🔧 Improvement'
3
+ about: 'Improve structure/format/performance/refactor/tests of the code.'
4
+ title: '[Improvement]'
5
+ labels: 'improvement'
6
+ ---
7
+
8
+ <!-- Please make sure your issue has not already been fixed. -->
9
+
10
+ ## Type of Improvement
11
+
12
+ <!-- Please uncomment the type of improvements this issue address -->
13
+
14
+ <!-- Files and Folders Structure -->
15
+ <!-- Performance -->
16
+ <!-- Refactoring code -->
17
+ <!-- Tests -->
18
+ <!-- Not Sure? -->
19
+
20
+ ## Proposal
@@ -0,0 +1,8 @@
1
+ ---
2
+ name: '🙋 Question'
3
+ about: 'Further information is requested.'
4
+ title: '[Question]'
5
+ labels: 'question'
6
+ ---
7
+
8
+ ### Question
@@ -0,0 +1,7 @@
1
+ <!-- Please first discuss the change you wish to make via issue before making a change. It might avoid a waste of your time. -->
2
+
3
+ ## What changes this PR introduce?
4
+
5
+ ## List any relevant issue numbers
6
+
7
+ ## Is there anything you'd like reviewers to focus on?
@@ -0,0 +1,28 @@
1
+ name: 'Lint'
2
+
3
+ on:
4
+ push:
5
+ branches: [master, develop]
6
+ pull_request:
7
+ branches: [master, develop]
8
+
9
+ jobs:
10
+ lint:
11
+ runs-on: 'ubuntu-latest'
12
+ steps:
13
+ - uses: 'actions/checkout@v2.4.0'
14
+
15
+ - name: 'Use Node.js'
16
+ uses: 'actions/setup-node@v2.5.1'
17
+ with:
18
+ node-version: 'lts/*'
19
+ cache: 'npm'
20
+
21
+ - name: 'Install'
22
+ run: 'npm install'
23
+
24
+ - run: 'npm run lint:commit -- --to "${{ github.sha }}"'
25
+ - run: 'npm run lint:editorconfig'
26
+ - run: 'npm run lint:markdown'
27
+ - run: 'npm run lint:javascript'
28
+ - run: 'npm run lint:prettier'
@@ -0,0 +1,29 @@
1
+ name: 'Release'
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+
7
+ jobs:
8
+ release:
9
+ runs-on: 'ubuntu-latest'
10
+ steps:
11
+ - uses: 'actions/checkout@v2.4.0'
12
+ with:
13
+ fetch-depth: 0
14
+ persist-credentials: false
15
+
16
+ - name: 'Use Node.js'
17
+ uses: 'actions/setup-node@v2.5.1'
18
+ with:
19
+ node-version: 'lts/*'
20
+ cache: 'npm'
21
+
22
+ - name: 'Install'
23
+ run: 'npm install'
24
+
25
+ - name: 'Release'
26
+ run: 'npm run release'
27
+ env:
28
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -0,0 +1,25 @@
1
+ name: 'Test'
2
+
3
+ on:
4
+ push:
5
+ branches: [master, develop]
6
+ pull_request:
7
+ branches: [master, develop]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: 'ubuntu-latest'
12
+ steps:
13
+ - uses: 'actions/checkout@v2.4.0'
14
+
15
+ - name: 'Use Node.js'
16
+ uses: 'actions/setup-node@v2.5.1'
17
+ with:
18
+ node-version: 'lts/*'
19
+ cache: 'npm'
20
+
21
+ - name: 'Install'
22
+ run: 'npm install'
23
+
24
+ - name: 'Test'
25
+ run: 'npm run test'
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ npm run lint:commit -- --edit
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ npm run lint:staged
5
+ npm run test
@@ -0,0 +1,6 @@
1
+ {
2
+ "*": ["editorconfig-checker"],
3
+ "*.{js,jsx,ts,tsx}": ["prettier --write", "eslint --fix"],
4
+ "*.{json,jsonc,yml,yaml}": ["prettier --write"],
5
+ "*.{md,mdx}": ["prettier --write", "markdownlint --dot --fix"]
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "default": true,
3
+ "MD013": false,
4
+ "MD033": false,
5
+ "MD041": false
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "singleQuote": true,
3
+ "jsxSingleQuote": true,
4
+ "semi": false,
5
+ "trailingComma": "none"
6
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "branches": ["master"],
3
+ "plugins": [
4
+ [
5
+ "@semantic-release/commit-analyzer",
6
+ {
7
+ "preset": "conventionalcommits"
8
+ }
9
+ ],
10
+ [
11
+ "@semantic-release/release-notes-generator",
12
+ {
13
+ "preset": "conventionalcommits"
14
+ }
15
+ ],
16
+ "@semantic-release/npm",
17
+ "@semantic-release/github"
18
+ ]
19
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "recommendations": [
3
+ "editorconfig.editorconfig",
4
+ "esbenp.prettier-vscode",
5
+ "dbaeumer.vscode-eslint",
6
+ "davidanson.vscode-markdownlint"
7
+ ]
8
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "typescript.tsdk": "node_modules/typescript/lib",
3
+ "typescript.preferences.importModuleSpecifierEnding": "js",
4
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
5
+ "prettier.configPath": ".prettierrc.json",
6
+ "editor.formatOnSave": true,
7
+ "editor.codeActionsOnSave": {
8
+ "source.fixAll": true
9
+ }
10
+ }
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ - Demonstrating empathy and kindness toward other people
21
+ - Being respectful of differing opinions, viewpoints, and experiences
22
+ - Giving and gracefully accepting constructive feedback
23
+ - Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ - Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ - The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ - Trolling, insulting or derogatory comments, and personal or political attacks
33
+ - Public or private harassment
34
+ - Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ - Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ contact@divlo.fr.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][mozilla coc].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][faq]. Translations are available
126
+ at [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
130
+ [mozilla coc]: https://github.com/mozilla/diversity
131
+ [faq]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
@@ -0,0 +1,46 @@
1
+ # 💡 Contributing
2
+
3
+ Thanks a lot for your interest in contributing to **eslint-config-conventions**! 🎉
4
+
5
+ ## Types of contributions
6
+
7
+ - Reporting a bug.
8
+ - Suggest a new feature idea.
9
+ - Correct spelling errors, improvements or additions to documentation files (README, CONTRIBUTING...).
10
+ - Improve structure/format/performance/refactor/tests of the code.
11
+
12
+ ## Pull Requests
13
+
14
+ - **Please first discuss** the change you wish to make via [issue](https://github.com/Divlo/eslint-config-conventions/issues) before making a change. It might avoid a waste of your time.
15
+
16
+ - Ensure your code respect linting.
17
+
18
+ - Make sure your **code passes the tests**.
19
+
20
+ If you're adding new features to **eslint-config-conventions**, please include tests.
21
+
22
+ ## Commits
23
+
24
+ The commit message guidelines respect [@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional) and [Semantic Versioning](https://semver.org/) for releases.
25
+
26
+ ### Types
27
+
28
+ Types define which kind of changes you made to the project.
29
+
30
+ | Types | Description |
31
+ | -------- | ------------------------------------------------------------------------------------------------------------ |
32
+ | feat | A new feature. |
33
+ | fix | A bug fix. |
34
+ | docs | Documentation only changes. |
35
+ | style | Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc). |
36
+ | refactor | A code change that neither fixes a bug nor adds a feature. |
37
+ | perf | A code change that improves performance. |
38
+ | test | Adding missing tests or correcting existing tests. |
39
+ | build | Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm). |
40
+ | ci | Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs). |
41
+ | chore | Other changes that don't modify src or test files. |
42
+ | revert | Reverts a previous commit. |
43
+
44
+ ### Scopes
45
+
46
+ Scopes define what part of the code changed.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Divlo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,126 @@
1
+ <h1 align="center">eslint-config-conventions</h1>
2
+
3
+ <p align="center">
4
+ <strong><a href="https://eslint.org/docs/developer-guide/shareable-configs">ESLint shareable config</a> to enforce strict conventions and good code quality.</strong>
5
+ </p>
6
+
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="./CONTRIBUTING.md"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat" /></a>
11
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/licence-MIT-blue.svg" alt="Licence MIT"/></a>
12
+ <a href="./CODE_OF_CONDUCT.md"><img src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg" alt="Contributor Covenant" /></a>
13
+ <br />
14
+ <a href="https://github.com/Divlo/eslint-config-conventions/actions/workflows/lint.yml"><img src="https://github.com/Divlo/eslint-config-conventions/actions/workflows/lint.yml/badge.svg?branch=develop" /></a>
15
+ <a href="https://github.com/Divlo/eslint-config-conventions/actions/workflows/test.yml"><img src="https://github.com/Divlo/eslint-config-conventions/actions/workflows/test.yml/badge.svg?branch=develop" /></a>
16
+ <br />
17
+ <a href="https://conventionalcommits.org"><img src="https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg" alt="Conventional Commits" /></a>
18
+ <a href="https://github.com/semantic-release/semantic-release"><img src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg" alt="semantic-release" /></a>
19
+ <a href="https://www.npmjs.com/package/eslint-config-conventions"><img src="https://img.shields.io/npm/v/eslint-config-conventions.svg" alt="npm version"></a>
20
+ </p>
21
+
22
+ ## 📜 About
23
+
24
+ **eslint-config-conventions** is a [ESLint](https://eslint.org) configuration to enforce strict conventions and good code quality, it is highly inspired from [eslint-config-standard-with-typescript](https://github.com/standard/eslint-config-standard-with-typescript) but it is **stricter** and with **no formatting rules**, **only code-quality rules**.
25
+
26
+ This configuration is mostly **for catching bugs** and **code-quality** so it is recommanded to use it with [Prettier](https://prettier.io/) for a consistent code style, it works with any `.prettierrc.json` configuration.
27
+
28
+ More information about **formatting rules** vs **code-quality rules** can be found on [Prettier vs. Linters](https://prettier.io/docs/en/comparison.html).
29
+
30
+ ## ⚙️ Getting Started
31
+
32
+ ### Prerequisites
33
+
34
+ - [Node.js](https://nodejs.org/) >= 16.0.0
35
+
36
+ ### Installation
37
+
38
+ `npm@<7` does not automatically install `peerDependencies`, so if that's what you're using, install them manually.
39
+ Here is an example, but use it only for reference, because your decisions regarding version ranges and range specifiers may vary.
40
+
41
+ ```sh
42
+ npm install --save-dev \
43
+ eslint@^8.9.0 \
44
+ eslint-plugin-import@^2.25.4 \
45
+ eslint-plugin-promise@^6.0.0 \
46
+ eslint-plugin-unicorn@^41.0.0 \
47
+ typescript@^4.4.0 \
48
+ @typescript-eslint/eslint-plugin@^5.12.0 \
49
+ eslint-config-conventions@latest
50
+ ```
51
+
52
+ Yes, this is a large number of packages. This is due to [a known limitation in ESLint](https://github.com/eslint/eslint/issues/3458).
53
+
54
+ This list of dependencies are:
55
+
56
+ - [ESLint](https://github.com/eslint/eslint)
57
+ - 3 [ESLint Plugins](https://eslint.org/docs/user-guide/configuring/plugins)
58
+ - [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import)
59
+ - [eslint-plugin-promise](https://github.com/xjamundx/eslint-plugin-promise)
60
+ - [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
61
+ - [TypeScript](https://github.com/Microsoft/TypeScript)
62
+ - [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint); ESLint rules for TypeScript.
63
+ - This package: `eslint-config-conventions`
64
+
65
+ ### Configuration with [Prettier](https://prettier.io/) (recommended)
66
+
67
+ You will need to install some dependencies in addition to those required:
68
+
69
+ ```sh
70
+ npm install --save-dev prettier eslint-config-prettier eslint-plugin-prettier
71
+
72
+ # Create an empty config file to let editors and other tools know you are using Prettier
73
+ # You can personalize it with your own rules
74
+ echo {}> .prettierrc.json
75
+ ```
76
+
77
+ #### `.eslintrc.json`
78
+
79
+ ```json
80
+ {
81
+ "extends": ["conventions", "prettier"],
82
+ "plugins": ["prettier"],
83
+ "parserOptions": {
84
+ "project": "./tsconfig.json"
85
+ },
86
+ "rules": {
87
+ "prettier/prettier": "error"
88
+ }
89
+ }
90
+ ```
91
+
92
+ **Note:** Please read some important instructions regarding the `project` option [here](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/README.md#configuration).
93
+
94
+ You must have a valid `tsconfig.json` file to specify `"parserOptions.project"`.
95
+
96
+ #### `package.json`
97
+
98
+ ```jsonc
99
+ {
100
+ "scripts": {
101
+ "lint:typescript": "eslint \"**/*.{js,jsx,ts,tsx}\" --ignore-path \".gitignore\"",
102
+ "lint:prettier": "prettier \".\" --check --ignore-path \".gitignore\""
103
+ }
104
+ }
105
+ ```
106
+
107
+ ### Usage
108
+
109
+ ```sh
110
+ npm run lint:typescript
111
+ # or to apply automatic fixes to code
112
+ npm run lint:typescript -- --fix
113
+
114
+ # Validate code formatting in all supported languages by Prettier
115
+ npm run lint:prettier
116
+ ```
117
+
118
+ ## 💡 Contributing
119
+
120
+ Anyone can help to improve the project, submit a Feature Request, a bug report or even correct a simple spelling mistake.
121
+
122
+ The steps to contribute can be found in the [CONTRIBUTING.md](./CONTRIBUTING.md) file.
123
+
124
+ ## 📄 License
125
+
126
+ [MIT](./LICENSE)
package/index.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./.eslintrc.json')
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "eslint-config-conventions",
3
+ "version": "1.0.0",
4
+ "public": true,
5
+ "description": "ESLint shareable config to enforce strict conventions and good code quality.",
6
+ "author": "Divlo <contact@divlo.fr>",
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/Divlo/eslint-config-conventions.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/Divlo/eslint-config-conventions/issues"
14
+ },
15
+ "homepage": "https://github.com/Divlo/eslint-config-conventions#readme",
16
+ "keywords": [
17
+ "eslintconfig",
18
+ "eslint",
19
+ "quality",
20
+ "strict linter",
21
+ "validate",
22
+ "code quality",
23
+ "conventions"
24
+ ],
25
+ "main": "index.js",
26
+ "engines": {
27
+ "node": ">=16.0.0",
28
+ "npm": ">=8.0.0"
29
+ },
30
+ "scripts": {
31
+ "lint:commit": "commitlint",
32
+ "lint:editorconfig": "editorconfig-checker",
33
+ "lint:markdown": "markdownlint \"**/*.md\" --dot --ignore-path \".gitignore\"",
34
+ "lint:javascript": "eslint \"**/*.{js,jsx,ts,tsx}\"",
35
+ "lint:prettier": "prettier \".\" --check --ignore-path \".gitignore\"",
36
+ "lint:staged": "lint-staged",
37
+ "test": "tape \"test/**/*.js\"",
38
+ "release": "semantic-release",
39
+ "_postinstall": "husky install",
40
+ "prepublishOnly": "pinst --disable",
41
+ "postpublish": "pinst --enable"
42
+ },
43
+ "peerDependencies": {
44
+ "eslint": "^8.9.0",
45
+ "eslint-plugin-import": "^2.25.4",
46
+ "eslint-plugin-promise": "^6.0.0",
47
+ "eslint-plugin-unicorn": "^41.0.0",
48
+ "typescript": "^4.4.0",
49
+ "@typescript-eslint/eslint-plugin": "^5.12.0"
50
+ },
51
+ "devDependencies": {
52
+ "@commitlint/cli": "16.2.1",
53
+ "@commitlint/config-conventional": "16.2.1",
54
+ "editorconfig-checker": "4.0.2",
55
+ "eslint": "8.9.0",
56
+ "@types/eslint": "8.4.1",
57
+ "eslint-plugin-import": "2.25.4",
58
+ "eslint-plugin-promise": "6.0.0",
59
+ "eslint-plugin-unicorn": "41.0.0",
60
+ "typescript": "4.5.5",
61
+ "@typescript-eslint/parser": "5.12.0",
62
+ "@typescript-eslint/eslint-plugin": "5.12.0",
63
+ "tape": "5.5.2",
64
+ "husky": "7.0.4",
65
+ "lint-staged": "12.3.4",
66
+ "markdownlint-cli": "0.31.1",
67
+ "@types/tape": "4.13.2",
68
+ "pinst": "2.1.6",
69
+ "prettier": "2.5.1",
70
+ "semantic-release": "19.0.2"
71
+ }
72
+ }
package/test/basic.js ADDED
@@ -0,0 +1,15 @@
1
+ const test = require('tape')
2
+
3
+ const config = require('../index.js')
4
+
5
+ test('test basic properties of config', function (t) {
6
+ t.ok(isObject(config.parserOptions))
7
+ t.ok(isObject(config.env))
8
+ t.ok(isObject(config.rules))
9
+ t.ok(isObject(config.overrides))
10
+ t.end()
11
+ })
12
+
13
+ function isObject(object) {
14
+ return typeof object === 'object' && object !== null
15
+ }
@@ -0,0 +1,5 @@
1
+ const foo = 1
2
+ const bar = (argument) => {
3
+ return argument + foo
4
+ }
5
+ bar(foo)
@@ -0,0 +1 @@
1
+ 'invalid eqeqeq' == 'invalid eqeqeq'
@@ -0,0 +1,3 @@
1
+ const foo = await 1
2
+ const bar = function () {}
3
+ await bar(foo)
@@ -0,0 +1,5 @@
1
+ const foo = 1
2
+ const bar = (argument: number): number => {
3
+ return argument + foo
4
+ }
5
+ bar(foo)
@@ -0,0 +1,5 @@
1
+ const foo = 1
2
+ const bar = (argument: number) => {
3
+ return argument + foo
4
+ }
5
+ bar(foo)
@@ -0,0 +1,37 @@
1
+ const { ESLint } = require('eslint')
2
+ const test = require('tape')
3
+
4
+ test('ensure we validate correctly JavaScript files', async (t) => {
5
+ const eslint = new ESLint({ ignore: false })
6
+ const [noErrors] = await eslint.lintFiles(
7
+ 'test/fixtures/javascript-no-errors.js'
8
+ )
9
+ const [withErrors] = await eslint.lintFiles(
10
+ 'test/fixtures/javascript-with-errors.js'
11
+ )
12
+ t.equal(noErrors.errorCount, 0)
13
+ t.equal(withErrors.errorCount, 3)
14
+ t.end()
15
+ })
16
+
17
+ test('ensure we validate correctly TypeScript files', async (t) => {
18
+ const eslint = new ESLint({ ignore: false })
19
+ const [noErrors] = await eslint.lintFiles(
20
+ 'test/fixtures/typescript-no-errors.ts'
21
+ )
22
+ const [withErrors] = await eslint.lintFiles(
23
+ 'test/fixtures/javascript-with-errors.js'
24
+ )
25
+ t.equal(noErrors.errorCount, 0)
26
+ t.equal(withErrors.errorCount, 3)
27
+ t.end()
28
+ })
29
+
30
+ test('ensure we allow top-level await', async (t) => {
31
+ const eslint = new ESLint({ ignore: false })
32
+ const [lintResult] = await eslint.lintFiles(
33
+ 'test/fixtures/top-level-await.mjs'
34
+ )
35
+ t.equal(lintResult.errorCount, 0)
36
+ t.end()
37
+ })
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "commonjs",
5
+ "lib": ["ESNext"],
6
+ "moduleResolution": "node",
7
+ "rootDir": "./",
8
+ "strict": true,
9
+ "skipLibCheck": true,
10
+ "esModuleInterop": true
11
+ }
12
+ }