@stanlemon/eslint-config 0.1.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/.eslintrc.js +1 -0
- package/README.md +18 -0
- package/index.js +45 -0
- package/package.json +33 -0
package/.eslintrc.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("./index.js");
|
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# ESLint Config
|
|
2
|
+
|
|
3
|
+
ESLint is great, but it takes a lot to setup! This is my attempt to create a package that contains all of the dependencies I need, plus a simple config to use.
|
|
4
|
+
|
|
5
|
+
To use this, simply create the following file:
|
|
6
|
+
|
|
7
|
+
.eslintrc.json
|
|
8
|
+
```json
|
|
9
|
+
{
|
|
10
|
+
"extends": [
|
|
11
|
+
"@stanlemon"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
For the most part this config utilizes `create-react-app` with support for `typescript` (only in typescript files) and is consistent with `prettier` formatting.
|
|
17
|
+
|
|
18
|
+
If you don't like it, use something else. ;)
|
package/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
es2021: true,
|
|
4
|
+
browser: true,
|
|
5
|
+
node: true,
|
|
6
|
+
jest: true,
|
|
7
|
+
},
|
|
8
|
+
extends: [
|
|
9
|
+
"react-app",
|
|
10
|
+
"plugin:jest/recommended",
|
|
11
|
+
"plugin:prettier/recommended",
|
|
12
|
+
],
|
|
13
|
+
rules: {
|
|
14
|
+
// Requires strict equality
|
|
15
|
+
eqeqeq: "error",
|
|
16
|
+
// If functions are too long, break them up into smaller ones
|
|
17
|
+
"max-lines-per-function": [
|
|
18
|
+
"error",
|
|
19
|
+
{
|
|
20
|
+
max: 80,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
// Linting shouldn't break on this, but we also want to discourage using console logging
|
|
24
|
+
"no-console": "warn",
|
|
25
|
+
// Requires the displayName property to be set, not ideal for stateless components
|
|
26
|
+
"react/display-name": "off",
|
|
27
|
+
// Allow exporting of unamed objects as a default
|
|
28
|
+
"import/no-anonymous-default-export": [
|
|
29
|
+
"error",
|
|
30
|
+
{
|
|
31
|
+
allowObject: true,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
overrides: [
|
|
36
|
+
{
|
|
37
|
+
files: ["**/*.ts", "**/*.tsx"],
|
|
38
|
+
extends: ["plugin:@typescript-eslint/recommended"],
|
|
39
|
+
rules: {
|
|
40
|
+
// Requires 'public' before public methods
|
|
41
|
+
"@typescript-eslint/explicit-member-accessibility": "off",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stanlemon/eslint-config",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "My typical eslint setup, but without all the copy and paste.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"eslint"
|
|
7
|
+
],
|
|
8
|
+
"author": "Stan Lemon <stanlemon@users.noreply.github.com>",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=17.0"
|
|
12
|
+
},
|
|
13
|
+
"type": "commonjs",
|
|
14
|
+
"scripts": {
|
|
15
|
+
"lint": "eslint --ext js,jsx,ts,tsx ./",
|
|
16
|
+
"lint:format": "eslint --fix --ext js,jsx,ts,tsx ./"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@babel/eslint-parser": "^7.16.5",
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "^5.7.0",
|
|
21
|
+
"@typescript-eslint/parser": "^5.7.0",
|
|
22
|
+
"babel-eslint": "^10.1.0",
|
|
23
|
+
"eslint": "^8.4.1",
|
|
24
|
+
"eslint-config-prettier": "^8.3.0",
|
|
25
|
+
"eslint-config-react-app": "^7.0.0",
|
|
26
|
+
"eslint-plugin-import": "^2.25.3",
|
|
27
|
+
"eslint-plugin-jest": "^25.3.0",
|
|
28
|
+
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
29
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
30
|
+
"eslint-plugin-react": "^7.27.1",
|
|
31
|
+
"eslint-plugin-react-hooks": "^4.3.0"
|
|
32
|
+
}
|
|
33
|
+
}
|