@luxass/eslint-config 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Lucas Nørgård
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,2 @@
1
+ # eslint-config
2
+ My shareable ESLint config
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@luxass/eslint-config",
3
+ "version": "1.0.0",
4
+ "description": "Luxass' ESLint config",
5
+ "author": "Lucas Norgaard <lucasnrgaard@gmail.com>",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/luxass/eslint-config.git"
10
+ },
11
+ "keywords": [
12
+ "eslint-config",
13
+ "eslint",
14
+ "config",
15
+ "eslintconfig"
16
+ ],
17
+ "main": "src/index.js",
18
+ "files": [
19
+ "src"
20
+ ],
21
+ "peerDependencies": {
22
+ "eslint": "^8.16.0",
23
+ "typescript": "^4.7.2"
24
+ },
25
+ "dependencies": {
26
+ "@typescript-eslint/eslint-plugin": "^5.27.0",
27
+ "@typescript-eslint/parser": "^5.27.0",
28
+ "eslint-config-standard": "^17.0.0",
29
+ "eslint-plugin-eslint-comments": "^3.2.0",
30
+ "eslint-plugin-import": "^2.26.0",
31
+ "eslint-plugin-jsonc": "^2.3.0",
32
+ "eslint-plugin-markdown": "^2.2.1",
33
+ "eslint-plugin-n": "^15.2.1",
34
+ "eslint-plugin-promise": "^6.0.0",
35
+ "eslint-plugin-react": "^7.30.0",
36
+ "eslint-plugin-unicorn": "^42.0.0",
37
+ "jsonc-eslint-parser": "^2.1.0"
38
+ },
39
+ "devDependencies": {
40
+ "eslint": "^8.16.0",
41
+ "typescript": "^4.7.2"
42
+ }
43
+ }
package/src/index.js ADDED
@@ -0,0 +1,163 @@
1
+ module.exports = {
2
+ env: {
3
+ es6: true,
4
+ browser: true,
5
+ node: true,
6
+ },
7
+ reportUnusedDisableDirectives: true,
8
+ extends: [
9
+ "eslint-config-standard",
10
+ "plugin:import/recommended",
11
+ "plugin:eslint-comments/recommended",
12
+ "plugin:jsonc/recommended-with-jsonc",
13
+ "plugin:markdown/recommended",
14
+ "./javascript",
15
+ "./typescript",
16
+ ],
17
+ ignorePatterns: [
18
+ "*.min.*",
19
+ "CHANGELOG.md",
20
+ "dist",
21
+ "LICENSE*",
22
+ "coverage",
23
+ "public",
24
+ "packages-lock.json",
25
+ "pnpm-lock.yaml",
26
+ "yarn.lock",
27
+ ],
28
+ plugins: ["unicorn"],
29
+ settings: {
30
+ "import/resolver": {
31
+ node: { extensions: [".js", ".mjs"] },
32
+ },
33
+ },
34
+ overrides: [
35
+ {
36
+ files: ["*.json", "*.json5"],
37
+ parser: "jsonc-eslint-parser",
38
+ rules: {
39
+ "jsonc/array-bracket-spacing": ["error", "never"],
40
+ "jsonc/comma-dangle": ["error", "never"],
41
+ "jsonc/comma-style": ["error", "last"],
42
+ "jsonc/indent": ["error", 2],
43
+ "jsonc/key-spacing": [
44
+ "error",
45
+ { beforeColon: false, afterColon: true },
46
+ ],
47
+ "jsonc/no-octal-escape": "error",
48
+ "jsonc/object-curly-newline": [
49
+ "error",
50
+ { multiline: true, consistent: true },
51
+ ],
52
+ "jsonc/object-curly-spacing": ["error", "always"],
53
+ "jsonc/object-property-newline": [
54
+ "error",
55
+ { allowMultiplePropertiesPerLine: true },
56
+ ],
57
+ },
58
+ },
59
+ {
60
+ files: ["package.json"],
61
+ parser: "jsonc-eslint-parser",
62
+ rules: {
63
+ "jsonc/sort-keys": [
64
+ "error",
65
+ {
66
+ pathPattern: "^$",
67
+ order: [
68
+ "name",
69
+ "publisher",
70
+ "displayName",
71
+ "version",
72
+ "private",
73
+ "type",
74
+ "packageManager",
75
+ "description",
76
+ "author",
77
+ "license",
78
+ "funding",
79
+ "homepage",
80
+ "repository",
81
+ "bugs",
82
+ "keywords",
83
+ "categories",
84
+ "sideEffects",
85
+ "exports",
86
+ "main",
87
+ "module",
88
+ "types",
89
+ "typesVersions",
90
+ "bin",
91
+ "icon",
92
+ "files",
93
+ "engines",
94
+ "activationEvents",
95
+ "contributes",
96
+ "scripts",
97
+ "peerDependencies",
98
+ "peerDependenciesMeta",
99
+ "dependencies",
100
+ "optionalDependencies",
101
+ "devDependencies",
102
+ "pnpm",
103
+ ],
104
+ },
105
+ {
106
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$",
107
+ order: { type: "asc" },
108
+ },
109
+ {
110
+ pathPattern: "^exports.*$",
111
+ order: ["types", "require", "import"],
112
+ },
113
+ ],
114
+ },
115
+ },
116
+ {
117
+ files: ["*.d.ts"],
118
+ rules: {
119
+ "import/no-duplicates": "off",
120
+ },
121
+ },
122
+ {
123
+ files: ["*.js"],
124
+ rules: {
125
+ "@typescript-eslint/no-var-requires": "off",
126
+ },
127
+ },
128
+ {
129
+ files: ["scripts/**/*.*", "cli.*"],
130
+ rules: {
131
+ "no-console": "off",
132
+ },
133
+ },
134
+ {
135
+ files: ["*.test.ts", "*.test.js", "*.spec.ts", "*.spec.js"],
136
+ rules: {
137
+ "no-unused-expressions": "off",
138
+ },
139
+ },
140
+ {
141
+ files: ["**/*.md/*.*"],
142
+ rules: {
143
+ "@typescript-eslint/no-redeclare": "off",
144
+ "@typescript-eslint/no-unused-vars": "off",
145
+ "@typescript-eslint/no-use-before-define": "off",
146
+ "@typescript-eslint/no-var-requires": "off",
147
+ "@typescript-eslint/comma-dangle": "off",
148
+ "import/no-unresolved": "off",
149
+ "no-alert": "off",
150
+ "no-console": "off",
151
+ "no-restricted-imports": "off",
152
+ "no-undef": "off",
153
+ "no-unused-expressions": "off",
154
+ "no-unused-vars": "off",
155
+ },
156
+ },
157
+ ],
158
+ rules: {
159
+ "eol-last": "off",
160
+ "no-trailing-spaces": "off",
161
+ "padded-blocks": "off",
162
+ },
163
+ };
@@ -0,0 +1,141 @@
1
+ module.exports = {
2
+ rules: {
3
+ "import/order": "error",
4
+ "import/first": "error",
5
+ "import/no-mutable-exports": "error",
6
+ "import/no-unresolved": "off",
7
+ "import/no-absolute-path": "off",
8
+ semi: ["warn", "always"],
9
+ quotes: ["error", "double"],
10
+ "quote-props": ["warn", "as-needed"],
11
+ "no-unused-vars": "warn",
12
+ "no-param-reassign": "off",
13
+ "array-bracket-spacing": ["error", "never"],
14
+ "brace-style": ["error", "1tbs", { allowSingleLine: true }],
15
+ "block-spacing": ["error", "always"],
16
+ camelcase: "off",
17
+ "comma-spacing": ["error", { before: false, after: true }],
18
+ "comma-style": ["error", "last"],
19
+ "comma-dangle": ["error", "only-multiline"],
20
+ "no-constant-condition": "warn",
21
+ "no-debugger": "error",
22
+ "no-console": ["error", { allow: ["warn", "error"] }],
23
+ "no-cond-assign": ["error", "always"],
24
+ "func-call-spacing": ["off", "never"],
25
+ "key-spacing": ["error", { beforeColon: false, afterColon: true }],
26
+ indent: [
27
+ "error",
28
+ 2,
29
+ { SwitchCase: 1, VariableDeclarator: 1, outerIIFEBody: 1 },
30
+ ],
31
+ "no-restricted-syntax": [
32
+ "error",
33
+ "DebuggerStatement",
34
+ "LabeledStatement",
35
+ "WithStatement",
36
+ ],
37
+ "object-curly-spacing": ["error", "always"],
38
+ "no-return-await": "off",
39
+ "space-before-function-paren": [
40
+ "error",
41
+ {
42
+ anonymous: "always",
43
+ named: "never",
44
+ asyncArrow: "always",
45
+ },
46
+ ],
47
+ // "no-multiple-empty-lines": ["warn", { max: 1, maxBOF: 0, maxEOF: 0 }],
48
+ "no-multiple-empty-lines": "off",
49
+ "no-var": "error",
50
+ "prefer-const": [
51
+ "error",
52
+ {
53
+ destructuring: "any",
54
+ ignoreReadBeforeAssign: true,
55
+ },
56
+ ],
57
+ "prefer-arrow-callback": [
58
+ "error",
59
+ {
60
+ allowNamedFunctions: false,
61
+ allowUnboundThis: true,
62
+ },
63
+ ],
64
+ "object-shorthand": [
65
+ "error",
66
+ "always",
67
+ {
68
+ ignoreConstructors: false,
69
+ avoidQuotes: true,
70
+ },
71
+ ],
72
+ "prefer-exponentiation-operator": "error",
73
+ "prefer-rest-params": "error",
74
+ "prefer-spread": "error",
75
+ "prefer-template": "error",
76
+ "template-curly-spacing": "error",
77
+ "arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
78
+ "generator-star-spacing": "off",
79
+ "spaced-comment": [
80
+ "error",
81
+ "always",
82
+ {
83
+ line: {
84
+ markers: ["/"],
85
+ exceptions: ["/", "#"],
86
+ },
87
+ block: {
88
+ markers: ["!"],
89
+ exceptions: ["*"],
90
+ balanced: true,
91
+ },
92
+ },
93
+ ],
94
+ "array-callback-return": "error",
95
+ "block-scoped-var": "error",
96
+ "consistent-return": "off",
97
+ complexity: ["off", 11],
98
+ eqeqeq: ["error", "smart"],
99
+ "no-alert": "warn",
100
+ "no-case-declarations": "error",
101
+ "no-multi-spaces": "error",
102
+ "no-multi-str": "error",
103
+ "no-with": "error",
104
+ "no-void": "error",
105
+ "no-useless-escape": "off",
106
+ "vars-on-top": "error",
107
+ "require-await": "off",
108
+ "no-return-assign": "off",
109
+ "operator-linebreak": ["error", "before"],
110
+ "unicorn/error-message": "error",
111
+ "unicorn/escape-case": "error",
112
+ "unicorn/no-instanceof-array": "error",
113
+ "unicorn/no-new-buffer": "error",
114
+ "unicorn/no-unsafe-regex": "off",
115
+ "unicorn/number-literal-case": "error",
116
+ "unicorn/prefer-includes": "error",
117
+ "unicorn/prefer-starts-ends-with": "error",
118
+ "unicorn/prefer-text-content": "error",
119
+ "unicorn/prefer-type-error": "error",
120
+ "unicorn/throw-new-error": "error",
121
+ "no-use-before-define": [
122
+ "error",
123
+ { functions: false, classes: false, variables: true },
124
+ ],
125
+ "eslint-comments/disable-enable-pair": "off",
126
+ "import/no-named-as-default-member": "off",
127
+ "import/no-named-as-default": "off",
128
+ "import/namespace": "off",
129
+ "n/no-callback-literal": "off",
130
+ "sort-imports": [
131
+ "error",
132
+ {
133
+ ignoreCase: false,
134
+ ignoreDeclarationSort: true,
135
+ ignoreMemberSort: false,
136
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
137
+ allowSeparatedGroups: false,
138
+ },
139
+ ],
140
+ },
141
+ };
@@ -0,0 +1,147 @@
1
+ module.exports = {
2
+ extends: [
3
+ "plugin:import/typescript",
4
+ "plugin:@typescript-eslint/recommended",
5
+ "plugin:react/recommended",
6
+ ],
7
+ settings: {
8
+ "import/resolver": {
9
+ node: { extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"] },
10
+ },
11
+ react: {
12
+ version: "17.0",
13
+ },
14
+ },
15
+ rules: {
16
+ "import/named": "off",
17
+ "@typescript-eslint/ban-ts-comment": [
18
+ "error",
19
+ { "ts-ignore": "allow-with-description" },
20
+ ],
21
+ "@typescript-eslint/member-delimiter-style": "warn",
22
+ "@typescript-eslint/type-annotation-spacing": ["error", {}],
23
+ "@typescript-eslint/consistent-type-imports": [
24
+ "error",
25
+ { prefer: "type-imports", disallowTypeAnnotations: false },
26
+ ],
27
+ "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
28
+ "@typescript-eslint/prefer-ts-expect-error": "error",
29
+ "no-useless-constructor": "off",
30
+ indent: "off",
31
+ "@typescript-eslint/indent": [
32
+ "error",
33
+ 2,
34
+ {
35
+ SwitchCase: 1,
36
+ VariableDeclarator: 1,
37
+ outerIIFEBody: 1,
38
+ MemberExpression: 1,
39
+ FunctionDeclaration: { parameters: 1, body: 1 },
40
+ FunctionExpression: { parameters: 1, body: 1 },
41
+ CallExpression: { arguments: 1 },
42
+ ArrayExpression: 1,
43
+ ObjectExpression: 1,
44
+ ImportDeclaration: 1,
45
+ flatTernaryExpressions: false,
46
+ ignoreComments: false,
47
+ ignoredNodes: [
48
+ "TemplateLiteral *",
49
+ "JSXElement",
50
+ "JSXElement > *",
51
+ "JSXAttribute",
52
+ "JSXIdentifier",
53
+ "JSXNamespacedName",
54
+ "JSXMemberExpression",
55
+ "JSXSpreadAttribute",
56
+ "JSXExpressionContainer",
57
+ "JSXOpeningElement",
58
+ "JSXClosingElement",
59
+ "JSXFragment",
60
+ "JSXOpeningFragment",
61
+ "JSXClosingFragment",
62
+ "JSXText",
63
+ "JSXEmptyExpression",
64
+ "JSXSpreadChild",
65
+ "TSTypeParameterInstantiation",
66
+ ],
67
+ offsetTernaryExpressions: true,
68
+ },
69
+ ],
70
+ "no-unused-vars": "off",
71
+ "@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
72
+ "no-redeclare": "off",
73
+ "@typescript-eslint/no-redeclare": "error",
74
+ "no-use-before-define": "off",
75
+ "@typescript-eslint/no-use-before-define": [
76
+ "error",
77
+ { functions: false, classes: false, variables: true },
78
+ ],
79
+ "brace-style": "off",
80
+ "@typescript-eslint/brace-style": [
81
+ "error",
82
+ "1tbs",
83
+ { allowSingleLine: true },
84
+ ],
85
+ "comma-dangle": "off",
86
+ "@typescript-eslint/comma-dangle": ["error", "only-multiline"],
87
+ "object-curly-spacing": "off",
88
+ "@typescript-eslint/object-curly-spacing": ["error", "always"],
89
+ semi: "off",
90
+ "@typescript-eslint/semi": ["warn", "always"],
91
+ quotes: "off",
92
+ "@typescript-eslint/quotes": ["warn", "double"],
93
+ "space-before-blocks": "off",
94
+ "@typescript-eslint/space-before-blocks": ["error", "always"],
95
+ "space-before-function-paren": "off",
96
+ "@typescript-eslint/space-before-function-paren": [
97
+ "error",
98
+ {
99
+ anonymous: "always",
100
+ named: "never",
101
+ asyncArrow: "always",
102
+ },
103
+ ],
104
+ "space-infix-ops": "off",
105
+ "@typescript-eslint/space-infix-ops": "error",
106
+ "keyword-spacing": "off",
107
+ "@typescript-eslint/keyword-spacing": [
108
+ "error",
109
+ { before: true, after: true },
110
+ ],
111
+ "comma-spacing": "off",
112
+ "@typescript-eslint/comma-spacing": [
113
+ "error",
114
+ { before: false, after: true },
115
+ ],
116
+ "no-extra-parens": "off",
117
+ "@typescript-eslint/no-extra-parens": ["error", "functions"],
118
+ "no-dupe-class-members": "off",
119
+ "@typescript-eslint/no-dupe-class-members": "error",
120
+ "no-loss-of-precision": "off",
121
+ "@typescript-eslint/no-loss-of-precision": "error",
122
+ "lines-between-class-members": "off",
123
+ "@typescript-eslint/lines-between-class-members": [
124
+ "error",
125
+ "always",
126
+ { exceptAfterSingleLine: true },
127
+ ],
128
+ "@typescript-eslint/consistent-indexed-object-style": "off",
129
+ "@typescript-eslint/naming-convention": "off",
130
+ "@typescript-eslint/explicit-function-return-type": "off",
131
+ "@typescript-eslint/explicit-member-accessibility": "off",
132
+ "@typescript-eslint/no-explicit-any": "off",
133
+ "@typescript-eslint/parameter-properties": "off",
134
+ "@typescript-eslint/no-empty-interface": "off",
135
+ "@typescript-eslint/ban-ts-ignore": "off",
136
+ "@typescript-eslint/no-empty-function": "off",
137
+ "@typescript-eslint/no-non-null-assertion": "off",
138
+ "@typescript-eslint/explicit-module-boundary-types": "off",
139
+ "@typescript-eslint/ban-types": "off",
140
+ "@typescript-eslint/no-namespace": "off",
141
+ "@typescript-eslint/triple-slash-reference": "off",
142
+
143
+ // REACT
144
+ "jsx-quotes": ["error", "prefer-double"],
145
+ "react/react-in-jsx-scope": "off",
146
+ },
147
+ };