eslint-config-arklint 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/.editorconfig ADDED
@@ -0,0 +1,10 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = tab
5
+ indent_size = 3
6
+ insert_final_newline = false
7
+ trim_trailing_whitespace = true
8
+
9
+ [*.md]
10
+ trim_trailing_whitespace = false
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Arkellys
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,38 @@
1
+ # eslint-config-arklint
2
+ My personal ESLint configuration. Most of it is based on [eslint-config-react-app](https://github.com/facebook/create-react-app/blob/0a827f69ab0d2ee3871ba9b71350031d8a81b7ae/packages/eslint-config-react-app/README.md) but with additional stylistic and JSDoc rules.
3
+
4
+ ---
5
+
6
+ ## Installation
7
+
8
+ ```shell
9
+ yarn add eslint-config-arklint -D
10
+ ```
11
+ ESLint and all the plugins used in the config are dependencies, so no need to install them. I'm aware that ESLint is supposed to be in the `peerDependencies`, but since I'm maintaining my own package, I'd rather have everything in one place for when I update the versions.
12
+
13
+ ## Usage
14
+
15
+ Add the extend in your `.eslintrc.js`:
16
+
17
+ ```javascript
18
+ module.exports = {
19
+ extends: "arklint",
20
+ rules: {
21
+ // Rule overrides
22
+ }
23
+ }
24
+ ```
25
+
26
+ The default configuration includes the extensions for `import` and `jsdoc`. The configuration for `react` has to be added manually:
27
+
28
+ ```javascript
29
+ module.exports = {
30
+ extends: [
31
+ "arklint",
32
+ "arklint/extensions/react"
33
+ ],
34
+ rules: {
35
+ // Rule overrides
36
+ }
37
+ }
38
+ ```
@@ -0,0 +1,26 @@
1
+ module.exports = {
2
+ parserOptions: {
3
+ sourceType: "module"
4
+ },
5
+ plugins: [
6
+ "import",
7
+ "sort-imports-es6-autofix"
8
+ ],
9
+ rules: {
10
+ "sort-imports-es6-autofix/sort-imports-es6": ["warn", {
11
+ ignoreCase: true,
12
+ memberSyntaxSortOrder: ["all", "multiple", "single", "none"]
13
+ }],
14
+ "import/no-anonymous-default-export": "off",
15
+ "import/newline-after-import": ["warn", { count: 2, considerComments: true }],
16
+ "import/order": ["warn", {
17
+ "newlines-between": "always",
18
+ "groups": [["type", "unknown", "builtin"], "external", ["internal", "parent", "index", "sibling"]],
19
+ "warnOnUnassignedImports": true,
20
+ "pathGroupsExcludedImportTypes": ["prop-types"]
21
+ }],
22
+ "import/first": "error",
23
+ "import/no-amd": "error",
24
+ "import/no-webpack-loader-syntax": "error"
25
+ }
26
+ };
@@ -0,0 +1,65 @@
1
+ module.exports = {
2
+ plugins: [
3
+ "jsdoc"
4
+ ],
5
+ extends: [
6
+ "plugin:jsdoc/recommended"
7
+ ],
8
+ rules: {
9
+ "jsdoc/require-returns": "off",
10
+ "jsdoc/require-jsdoc": "off",
11
+ "jsdoc/check-param-names": "warn",
12
+ "jsdoc/check-indentation": "warn",
13
+ "jsdoc/no-bad-blocks": "warn",
14
+ "jsdoc/tag-lines": ["warn", "never"],
15
+ "jsdoc/no-defaults": "off",
16
+ "jsdoc/require-hyphen-before-param-description": ["warn", "always", {
17
+ tags: {
18
+ property: "always",
19
+ return: "never"
20
+ }
21
+ }],
22
+ "jsdoc/check-line-alignment": ["warn", "never"],
23
+ "jsdoc/match-name": ["warn", {
24
+ match: [{
25
+ allowName: "/^([A-Z][a-z]+)+$/",
26
+ message: "The name should be written in PascalCase.",
27
+ tags: ["callback", "typedef"]
28
+ }]
29
+ }],
30
+ "jsdoc/match-description": ["warn", {
31
+ contexts: ["any"],
32
+ mainDescription: {
33
+ message: "The main description should be written in the third person, begin with a capital letter and end with a period.",
34
+ match: "/^[A-Z][.^\\w]*s\\b.*\\.$/us"
35
+ },
36
+ matchDescription: "[A-Z].*|^\\w+([-]*\\w)*( \\| \\w+([-]*\\w)*)*$",
37
+ tags: {
38
+ param: {
39
+ message: "@param description should begin with a capital letter or be a list of options separated by pipes.",
40
+ match: true
41
+ },
42
+ property: {
43
+ message: "@property description should begin with a capital letter or be a list of options separated by pipes.",
44
+ match: true
45
+ },
46
+ returns: {
47
+ message: "@returns description should begin with a capital letter.",
48
+ match: "[A-Z].*"
49
+ }
50
+ }
51
+ }]
52
+ },
53
+ settings: {
54
+ jsdoc: {
55
+ maxLines: 2,
56
+ mode: "typescript",
57
+ preferredTypes: {
58
+ "object.<>": false,
59
+ "Object": "object",
60
+ "<>": ".<>",
61
+ "*": "any"
62
+ }
63
+ }
64
+ }
65
+ };
@@ -0,0 +1,68 @@
1
+ module.exports = {
2
+ parserOptions: {
3
+ ecmaFeatures: {
4
+ jsx: true
5
+ }
6
+ },
7
+ settings: {
8
+ react: {
9
+ version: "detect"
10
+ }
11
+ },
12
+ plugins: [
13
+ "react",
14
+ "react-hooks",
15
+ "jsx-a11y"
16
+ ],
17
+ extends: [
18
+ "plugin:react/recommended",
19
+ "plugin:react/jsx-runtime"
20
+ ],
21
+ rules: {
22
+ "react/no-typos": "error",
23
+ "react/prop-types": ["warn", { ignore: ["t"] }],
24
+ "react/display-name": "warn",
25
+ "react/jsx-fragments": ["warn", "element"],
26
+ "react/jsx-key": "warn",
27
+ "react/jsx-first-prop-new-line": ["warn", "multiline"],
28
+ "react/jsx-max-props-per-line": ["warn", { maximum: { single: 3, multi: 1 } }],
29
+ "react/jsx-wrap-multilines": "warn",
30
+ "react/jsx-boolean-value": ["warn", "never"],
31
+ "react/jsx-closing-bracket-location": "warn",
32
+ "react/jsx-no-duplicate-props": "warn",
33
+ "react/jsx-curly-brace-presence": "warn",
34
+ "react/jsx-uses-vars": "warn",
35
+ "react/jsx-uses-react": "warn",
36
+ "react/forbid-foreign-prop-types": ["warn", { allowInPropTypes: true }],
37
+ "react/jsx-no-comment-textnodes": "warn",
38
+ "react-hooks/exhaustive-deps": "warn",
39
+ "react/jsx-no-target-blank": "warn",
40
+ "react/jsx-no-undef": "error",
41
+ "react/jsx-pascal-case": "warn",
42
+ "react/no-danger-with-children": "warn",
43
+ "react/no-direct-mutation-state": "warn",
44
+ "react/no-is-mounted": "warn",
45
+ "react/require-render-return": "error",
46
+ "react-hooks/rules-of-hooks": "error",
47
+ "react/style-prop-object": "warn",
48
+ "jsx-a11y/alt-text": "warn",
49
+ "jsx-a11y/anchor-has-content": "warn",
50
+ "jsx-a11y/anchor-is-valid": ["warn", {
51
+ aspects: ["noHref", "invalidHref"]
52
+ }],
53
+ "jsx-a11y/aria-activedescendant-has-tabindex": "warn",
54
+ "jsx-a11y/aria-props": "warn",
55
+ "jsx-a11y/aria-proptypes": "warn",
56
+ "jsx-a11y/aria-role": ["warn", { ignoreNonDOM: true }],
57
+ "jsx-a11y/aria-unsupported-elements": "warn",
58
+ "jsx-a11y/heading-has-content": "warn",
59
+ "jsx-a11y/iframe-has-title": "warn",
60
+ "jsx-a11y/img-redundant-alt": "warn",
61
+ "jsx-a11y/no-access-key": "warn",
62
+ "jsx-a11y/no-distracting-elements": "warn",
63
+ "jsx-a11y/no-redundant-roles": "warn",
64
+ "jsx-a11y/role-has-required-aria-props": "warn",
65
+ "jsx-a11y/role-supports-aria-props": "warn",
66
+ "jsx-a11y/scope": "warn"
67
+ }
68
+ };
package/index.js ADDED
@@ -0,0 +1,135 @@
1
+ const restrictedGlobals = require("confusing-browser-globals");
2
+
3
+
4
+ module.exports = {
5
+ env: {
6
+ browser: true,
7
+ commonjs: true,
8
+ es6: true,
9
+ node: true
10
+ },
11
+ parserOptions: {
12
+ ecmaVersion: 2023
13
+ },
14
+ ignorePatterns: ["node_modules/"],
15
+ extends: [
16
+ "eslint:recommended",
17
+ "./extensions/import.js",
18
+ "./extensions/jsdoc.js"
19
+ ],
20
+ rules: {
21
+ "quotes": ["warn", "double"],
22
+ "semi": "warn",
23
+ "camelcase": "warn",
24
+ "no-multi-spaces": "warn",
25
+ "array-bracket-spacing": "warn",
26
+ "object-curly-spacing": ["warn", "always"],
27
+ "space-infix-ops": "warn",
28
+ "space-in-parens": "warn",
29
+ "spaced-comment": ["warn", "always"],
30
+ "comma-spacing": "warn",
31
+ "comma-dangle": ["warn", "never"],
32
+ "prefer-arrow-callback": "warn",
33
+ "quote-props": ["warn", "consistent-as-needed"],
34
+ "nonblock-statement-body-position": "warn",
35
+ "arrow-body-style": "warn",
36
+ "dot-notation": "warn",
37
+ "no-var": "warn",
38
+ "indent": ["warn", "tab", { SwitchCase: 1, ignoreComments: true }],
39
+ "no-duplicate-imports": "warn",
40
+ "no-multiple-empty-lines": ["warn", { max: 2, maxBOF: 0, maxEOF: 0 }],
41
+ "no-restricted-globals": ["error"].concat(restrictedGlobals),
42
+ "array-callback-return": "warn",
43
+ "default-case": ["warn", { commentPattern: "^no default$" }],
44
+ "dot-location": ["warn", "property"],
45
+ "eqeqeq": ["warn", "smart"],
46
+ "new-parens": "warn",
47
+ "no-array-constructor": "warn",
48
+ "no-caller": "warn",
49
+ "no-case-declarations": "off",
50
+ "no-cond-assign": ["warn", "except-parens"],
51
+ "no-const-assign": "warn",
52
+ "no-control-regex": "warn",
53
+ "no-delete-var": "warn",
54
+ "no-dupe-args": "warn",
55
+ "no-dupe-class-members": "warn",
56
+ "no-dupe-keys": "warn",
57
+ "no-duplicate-case": "warn",
58
+ "no-empty-character-class": "warn",
59
+ "no-empty-pattern": "warn",
60
+ "no-async-promise-executor": "off",
61
+ "no-eval": "warn",
62
+ "no-ex-assign": "warn",
63
+ "no-extend-native": "warn",
64
+ "no-extra-bind": "warn",
65
+ "no-extra-label": "warn",
66
+ "no-extra-semi": "off",
67
+ "no-fallthrough": "warn",
68
+ "no-func-assign": "warn",
69
+ "no-implied-eval": "warn",
70
+ "no-invalid-regexp": "warn",
71
+ "no-iterator": "warn",
72
+ "no-label-var": "warn",
73
+ "no-labels": ["warn", { allowLoop: true, allowSwitch: false }],
74
+ "no-lone-blocks": "warn",
75
+ "no-loop-func": "warn",
76
+ "no-mixed-operators": "warn",
77
+ "no-multi-str": "warn",
78
+ "no-global-assign": "warn",
79
+ "no-unsafe-negation": "warn",
80
+ "no-new-func": "warn",
81
+ "no-new-object": "warn",
82
+ "no-new-symbol": "warn",
83
+ "no-new-wrappers": "warn",
84
+ "no-obj-calls": "warn",
85
+ "no-octal": "warn",
86
+ "no-octal-escape": "warn",
87
+ "no-redeclare": "warn",
88
+ "no-regex-spaces": "warn",
89
+ "no-restricted-syntax": ["warn", "WithStatement"],
90
+ "no-script-url": "warn",
91
+ "no-self-assign": "warn",
92
+ "no-self-compare": "warn",
93
+ "no-sequences": "warn",
94
+ "no-shadow-restricted-names": "warn",
95
+ "no-sparse-arrays": "warn",
96
+ "no-template-curly-in-string": "warn",
97
+ "no-this-before-super": "warn",
98
+ "no-throw-literal": "warn",
99
+ "no-undef": "error",
100
+ "no-unreachable": "warn",
101
+ "no-unused-expressions": ["error", {
102
+ allowShortCircuit: true,
103
+ allowTernary: true,
104
+ allowTaggedTemplates: true
105
+ }],
106
+ "no-unused-labels": "warn",
107
+ "no-unused-vars": ["warn", {
108
+ args: "none",
109
+ ignoreRestSiblings: true
110
+ }],
111
+ "no-use-before-define": ["warn", {
112
+ functions: false,
113
+ classes: false,
114
+ variables: false
115
+ }],
116
+ "no-useless-computed-key": "warn",
117
+ "no-useless-concat": "warn",
118
+ "no-useless-constructor": "warn",
119
+ "no-useless-escape": "warn",
120
+ "no-useless-rename": ["warn", {
121
+ ignoreDestructuring: false,
122
+ ignoreImport: false,
123
+ ignoreExport: false
124
+ }],
125
+ "no-with": "warn",
126
+ "no-whitespace-before-property": "warn",
127
+ "require-yield": "warn",
128
+ "rest-spread-spacing": ["warn", "never"],
129
+ "strict": ["warn", "never"],
130
+ "unicode-bom": ["warn", "never"],
131
+ "use-isnan": "warn",
132
+ "valid-typeof": "warn",
133
+ "getter-return": "warn"
134
+ }
135
+ };
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "eslint-config-arklint",
3
+ "version": "1.0.0",
4
+ "author": "Arkellys",
5
+ "license": "MIT",
6
+ "main": "index.js",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/Arkellys/eslint-config-arklint.git"
10
+ },
11
+ "homepage": "https://github.com/Arkellys/eslint-config-arklint#readme",
12
+ "dependencies": {
13
+ "confusing-browser-globals": "^1.0.11",
14
+ "eslint": "^8.46.0",
15
+ "eslint-plugin-import": "^2.28.0",
16
+ "eslint-plugin-jsdoc": "^46.4.6",
17
+ "eslint-plugin-jsx-a11y": "^6.7.1",
18
+ "eslint-plugin-react": "^7.33.1",
19
+ "eslint-plugin-react-hooks": "^4.6.0",
20
+ "eslint-plugin-sort-imports-es6-autofix": "^0.6.0"
21
+ },
22
+ "eslintConfig": {
23
+ "extends": "./index.js"
24
+ }
25
+ }