Skip to content

Commit 7974350

Browse files
committed
Eslint and prettier config
1 parent 7767546 commit 7974350

26 files changed

+2686
-921
lines changed

Diff for: .eslintignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Folders
2+
dist/
3+
assets/
4+
5+
# Files
6+
README.md

Diff for: .eslintrc.json

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"root": true,
3+
"env": {
4+
"browser": true,
5+
"es2021": true,
6+
"node": true
7+
},
8+
"extends": [
9+
"eslint:recommended",
10+
"plugin:react/recommended",
11+
"plugin:@typescript-eslint/recommended",
12+
"plugin:prettier/recommended",
13+
"plugin:react-hooks/recommended"
14+
],
15+
"overrides": [],
16+
"parser": "@typescript-eslint/parser",
17+
"parserOptions": {
18+
"ecmaVersion": "latest",
19+
"ecmaFeatures": {
20+
"jsx": true
21+
},
22+
"sourceType": "module"
23+
},
24+
"settings": {
25+
"react": {
26+
"version": "detect"
27+
}
28+
},
29+
"plugins": ["react", "@typescript-eslint", "import", "prettier"],
30+
"rules": {
31+
"indent": "off",
32+
"linebreak-style": ["error", "unix"],
33+
"quotes": ["error", "double"],
34+
"semi": ["error", "always"],
35+
"import/order": [
36+
"error",
37+
{
38+
"alphabetize": {
39+
"order": "asc",
40+
"caseInsensitive": true
41+
},
42+
"newlines-between": "always"
43+
}
44+
],
45+
"react/prop-types": "off",
46+
"react/jsx-uses-react": "off",
47+
"react/react-in-jsx-scope": "off",
48+
"react-hooks/rules-of-hooks": "error",
49+
"react-hooks/exhaustive-deps": "warn",
50+
"@typescript-eslint/no-var-requires": 0
51+
}
52+
}

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ coverage
1212
build
1313
dist
1414
.rpt2_cache
15+
.eslintcache
1516

1617
# misc
1718
.DS_Store

Diff for: .npmignore

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ tsconfig.json
1010
rollup.config.js
1111
.git
1212
.gitignore
13+
.eslintignore
14+
.eslintrc.json
15+
.prettierrc
16+
.prettierignore
1317
.DS_Store
1418
npm-debug.log
1519
package-lock.json

Diff for: .prettierignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Folders
2+
dist/
3+
assets/
4+
5+
# Files
6+
README.md

Diff for: .prettierrc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"semi": true,
3+
"tabWidth": 4,
4+
"printWidth": 100,
5+
"singleQuote": false,
6+
"trailingComma": "none",
7+
"quoteProps": "as-needed",
8+
"jsxSingleQuote": false,
9+
"bracketSpacing": true,
10+
"arrowParens": "avoid",
11+
"proseWrap": "always"
12+
}

Diff for: package.json

+19-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@
88
"author": "onesine",
99
"license": "MIT",
1010
"scripts": {
11-
"prebuild": "rm -rf dist",
12-
"build": "npm run prebuild && rollup -c"
11+
"watch": "rollup -c -w",
12+
"clean": "rm -rf dist",
13+
"lint": "eslint .",
14+
"lint:fix": "eslint --fix .",
15+
"pret": "prettier -c .",
16+
"pret:fix": "prettier -w .",
17+
"format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc",
18+
"build": "npm run pret && npm run lint && npm run clean && rollup -c"
1319
},
1420
"repository": {
1521
"type": "git",
@@ -29,17 +35,27 @@
2935
],
3036
"peerDependencies": {
3137
"dayjs": "^1.11.6",
32-
"react": "^18.2.0"
38+
"react": "^17.0.2 || ^18.2.0"
3339
},
3440
"devDependencies": {
3541
"@rollup/plugin-commonjs": "^22.0.1",
3642
"@rollup/plugin-node-resolve": "^13.3.0",
3743
"@rollup/plugin-typescript": "^9.0.2",
3844
"@tailwindcss/forms": "^0.5.3",
3945
"@types/react": "^18.0.21",
46+
"@typescript-eslint/eslint-plugin": "^5.45.0",
47+
"@typescript-eslint/parser": "^5.45.0",
4048
"autoprefixer": "^10.4.13",
4149
"dayjs": "^1.11.6",
50+
"eslint": "^8.29.0",
51+
"eslint-config-prettier": "^8.5.0",
52+
"eslint-plugin-import": "^2.26.0",
53+
"eslint-plugin-prettier": "^4.2.1",
54+
"eslint-plugin-react": "^7.31.11",
55+
"eslint-plugin-react-hooks": "^4.6.0",
4256
"postcss": "^8.4.19",
57+
"prettier": "^2.8.0",
58+
"react": "^18.2.0",
4359
"rollup": "^2.77.2",
4460
"tailwindcss": "^3.2.4",
4561
"tslib": "^2.4.0",

Diff for: rollup.config.js

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import commonjs from '@rollup/plugin-commonjs';
2-
import resolve from '@rollup/plugin-node-resolve';
1+
import commonjs from "@rollup/plugin-commonjs";
2+
import resolve from "@rollup/plugin-node-resolve";
33
import typescript from "@rollup/plugin-typescript";
44

55
const packageJson = require("./package.json");
@@ -11,19 +11,15 @@ export default {
1111
file: packageJson.main,
1212
format: "cjs",
1313
exports: "auto",
14-
sourcemap: true,
14+
sourcemap: true
1515
},
1616
{
1717
file: packageJson.module,
1818
format: "esm",
1919
exports: "auto",
20-
sourcemap: true,
21-
},
20+
sourcemap: true
21+
}
2222
],
2323
external: ["react", "dayjs"],
24-
plugins: [
25-
resolve(),
26-
commonjs(),
27-
typescript(),
28-
]
29-
};
24+
plugins: [resolve(), commonjs(), typescript()]
25+
};

0 commit comments

Comments
 (0)