@prowise/eslint-config-linting-rules 0.0.1
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/.eslintrc.js +7 -0
- package/README.md +19 -0
- package/backend.js +16 -0
- package/frontend.js +24 -0
- package/index.js +44 -0
- package/package.json +1 -0
- package/src/rules/base-rules.js +1957 -0
- package/src/rules/plugin-import-rules.js +315 -0
- package/src/rules/plugin-jsdoc-rules.js +321 -0
- package/src/rules/plugin-jsx-a11y-rules.js +294 -0
- package/src/rules/plugin-node-rules.js +61 -0
- package/src/rules/plugin-react-hooks-rules.js +23 -0
- package/src/rules/plugin-react-rules.js +765 -0
- package/src/rules/plugin-typescript-rules.js +928 -0
- package/typescript.js +18 -0
package/.eslintrc.js
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Prowise linting rules #
|
|
2
|
+
|
|
3
|
+
This repository contains the Prowise basic linting rules
|
|
4
|
+
Rules are based on:
|
|
5
|
+
* the airbnb rule sets
|
|
6
|
+
* the recommended rules of eslint and the different plugins
|
|
7
|
+
* Prowise preferences
|
|
8
|
+
### What is this repository for? ###
|
|
9
|
+
|
|
10
|
+
* Easy setup to all linting rules on a code repository
|
|
11
|
+
|
|
12
|
+
### How to use ###
|
|
13
|
+
|
|
14
|
+
* Install this package with `npm install @prowise/eslint-config-linting-rules -D`
|
|
15
|
+
* Depending on the type of project, add the following line to your `eslintrc` file:
|
|
16
|
+
* Plain javascript project: ```"extends": ["@prowise/eslint-config-linting-rules"],```
|
|
17
|
+
* Typescript project: ```"extends": ["@prowise/eslint-config-linting-rules/typescript"],```
|
|
18
|
+
* Node-typescript backend project: ```"extends": ["@prowise/eslint-config-linting-rules/backend"],```
|
|
19
|
+
* React-typescript frontend project: ```"extends": ["@prowise/eslint-config-linting-rules/frontend"],```
|
package/backend.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const { rules: nodeRules } = require("./src/rules/plugin-node-rules");
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
extends: ["./typescript.js"].map(require.resolve),
|
|
5
|
+
|
|
6
|
+
env: { node: true },
|
|
7
|
+
|
|
8
|
+
globals: {
|
|
9
|
+
Atomics: "readonly",
|
|
10
|
+
SharedArrayBuffer: "readonly",
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
plugins: ["eslint-plugin-node"],
|
|
14
|
+
|
|
15
|
+
rules: { ...nodeRules },
|
|
16
|
+
};
|
package/frontend.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const { rules: reactHooksRules } = require("./src/rules/plugin-react-hooks-rules");
|
|
2
|
+
const { rules: reactRules } = require("./src/rules/plugin-react-rules");
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
extends: ["./typescript.js"].map(require.resolve),
|
|
6
|
+
|
|
7
|
+
env: { browser: true },
|
|
8
|
+
|
|
9
|
+
globals: {
|
|
10
|
+
Atomics: "readonly",
|
|
11
|
+
SharedArrayBuffer: "readonly",
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
parserOptions: {
|
|
15
|
+
ecmaFeatures: { jsx: true },
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
plugins: ["eslint-plugin-react", "eslint-plugin-react-hooks"],
|
|
19
|
+
|
|
20
|
+
rules: {
|
|
21
|
+
...reactRules,
|
|
22
|
+
...reactHooksRules,
|
|
23
|
+
},
|
|
24
|
+
};
|
package/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const { rules: baseRules } = require("./src/rules/base-rules");
|
|
2
|
+
const { rules: importsRules } = require("./src/rules/plugin-import-rules");
|
|
3
|
+
const { rules: jsDocRules } = require("./src/rules/plugin-jsdoc-rules");
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
env: {
|
|
7
|
+
jest: true,
|
|
8
|
+
es2021: true,
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
plugins: [
|
|
12
|
+
"eslint-plugin-import",
|
|
13
|
+
"eslint-plugin-prefer-arrow",
|
|
14
|
+
"eslint-plugin-jest",
|
|
15
|
+
"eslint-plugin-jsdoc",
|
|
16
|
+
"eslint-plugin-prettier",
|
|
17
|
+
],
|
|
18
|
+
|
|
19
|
+
parserOptions: {
|
|
20
|
+
ecmaVersion: 2021,
|
|
21
|
+
sourceType: "module",
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
rules: {
|
|
25
|
+
...baseRules,
|
|
26
|
+
...importsRules,
|
|
27
|
+
...jsDocRules,
|
|
28
|
+
"prefer-arrow/prefer-arrow-functions": [
|
|
29
|
+
"warn",
|
|
30
|
+
{
|
|
31
|
+
disallowPrototype: true,
|
|
32
|
+
singleReturnOnly: false,
|
|
33
|
+
classPropertiesAllowed: false,
|
|
34
|
+
allowStandaloneDeclarations: true,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
"jest/no-disabled-tests": "warn",
|
|
38
|
+
"jest/no-focused-tests": "error",
|
|
39
|
+
"jest/no-identical-title": "error",
|
|
40
|
+
"jest/prefer-to-have-length": "warn",
|
|
41
|
+
"jest/valid-expect": "error",
|
|
42
|
+
"prettier/prettier": ["error", { singleQuote: false, tabWidth: 4, printWidth: 120, trailingComma: "all" }],
|
|
43
|
+
},
|
|
44
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"@prowise/eslint-config-linting-rules","version":"0.0.1","description":"Default Prowise linting rules for npm packages.","main":"index.js","exports":{"./typescript":"./typescript.js","./backend":"./backend.js","./frontend":"./frontend.js"},"scripts":{"lint":"eslint ."},"repository":{"type":"git","url":"git+ssh://git@bitbucket.org/prowise/npm-linting-rules.git"},"author":"Prowise B.V.","license":"UNLICENSED","homepage":"https://bitbucket.org/prowise/npm-linting-rules#readme","devDependencies":{"@typescript-eslint/eslint-plugin":"^5.36.2","@typescript-eslint/parser":"^5.36.2","eslint-import-resolver-typescript":"^3.5.1","eslint-plugin-import":"^2.26.0","eslint-plugin-jest":"^27.0.1","eslint-plugin-jsdoc":"^39.3.6","eslint-plugin-node":"^11.1.0","eslint-plugin-prefer-arrow":"^1.2.3","eslint-plugin-prettier":"^4.2.1","eslint-plugin-react":"^7.31.7","eslint-plugin-react-hooks":"^4.6.0"},"dependencies":{"confusing-browser-globals":"^1.0.11","eslint":"^8.23.0","object.assign":"^4.1.4","semver":"^7.3.7"}}
|