Skip to content

Commit ed6d112

Browse files
manudelibvaughn
andauthored
ci(eslint): use eslint+prettier with ci strictly (#165)
* ci(eslint): use eslint+prettier with ci strictly * Fixed all warnings --------- Co-authored-by: Brian Vaughn <[email protected]>
1 parent 54a2838 commit ed6d112

13 files changed

+1727
-116
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

.eslintrc.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
browser: true,
5+
es2021: true,
6+
},
7+
extends: [
8+
"plugin:react/recommended",
9+
"plugin:@typescript-eslint/recommended",
10+
"plugin:prettier/recommended",
11+
],
12+
overrides: [
13+
{
14+
env: {
15+
node: true,
16+
},
17+
files: [".eslintrc.{js,cjs}"],
18+
parserOptions: {
19+
sourceType: "script",
20+
},
21+
},
22+
],
23+
parser: "@typescript-eslint/parser",
24+
parserOptions: {
25+
ecmaVersion: "latest",
26+
sourceType: "module",
27+
},
28+
plugins: ["react"],
29+
rules: {
30+
"react/no-did-update-set-state": "off",
31+
"react/react-in-jsx-scope": "off",
32+
"react/prop-types": "off",
33+
"@typescript-eslint/no-explicit-any": "off",
34+
},
35+
};
Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
name: "Jest unit tests"
2-
on: [pull_request]
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
37
jobs:
4-
tests-e2e:
8+
ci:
59
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
command: ['pnpm lint', 'pnpm typescript', 'pnpm test']
613
steps:
714
- uses: actions/checkout@v3
815
- uses: pnpm/action-setup@v2
@@ -13,9 +20,7 @@ jobs:
1320
cache: "pnpm"
1421
cache-dependency-path: "pnpm-lock.yaml"
1522
node-version-file: ".nvmrc"
16-
- name: Install dependencies
17-
run: pnpm install
18-
- name: Build NPM packages
19-
run: pnpm run prerelease
20-
- name: Run tests
21-
run: pnpm run test
23+
- run: pnpm install --frozen-lockfile
24+
- run: pnpm prerelease
25+
- name: Run cis
26+
run: ${{ matrix.command }}

.github/workflows/prettier.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/typescript.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.prettierrc.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,12 @@
22
"trailingComma": "es5",
33
"tabWidth": 2,
44
"semi": true,
5-
"singleQuote": false
5+
"singleQuote": false,
6+
"arrowParens": "always",
7+
"bracketSameLine": false,
8+
"bracketSpacing": true,
9+
"endOfLine": "lf",
10+
"jsxSingleQuote": false,
11+
"proseWrap": "preserve",
12+
"quoteProps": "as-needed"
613
}

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
"clear:builds": "rm -rf ./dist",
4545
"clear:node_modules": "rm -rf ./node_modules",
4646
"prerelease": "preconstruct build",
47-
"prettier": "prettier --write \"**/*.{css,html,js,json,jsx,ts,tsx}\"",
48-
"prettier:ci": "prettier --check \"**/*.{css,html,js,json,jsx,ts,tsx}\"",
47+
"lint": "eslint .",
48+
"lint:fix": "eslint . --fix",
4949
"test": "jest",
5050
"test:watch": "jest --watch",
5151
"typescript": "tsc --noEmit",
@@ -58,12 +58,20 @@
5858
"@babel/preset-env": "^7.22.5",
5959
"@babel/preset-typescript": "^7.21.5",
6060
"@preconstruct/cli": "^2.8.1",
61+
"@types/assert": "^1.5.10",
6162
"@types/jest": "^26.0.15",
6263
"@types/react": "^18",
6364
"@types/react-dom": "^18",
65+
"@typescript-eslint/eslint-plugin": "^5.52.0",
66+
"assert": "^2.0.0",
67+
"eslint": "^8.0.1",
68+
"eslint-config-prettier": "^9.0.0",
69+
"eslint-plugin-import": "^2.25.2",
70+
"eslint-plugin-prettier": "^5.0.0",
71+
"eslint-plugin-react": "^7.33.1",
6472
"jest": "^29.4.3",
6573
"jest-environment-jsdom": "^29.4.3",
66-
"prettier": "^2.8.6",
74+
"prettier": "^3.0.1",
6775
"react": "^18",
6876
"react-dom": "^18",
6977
"ts-jest": "^29.0.5",
@@ -72,14 +80,6 @@
7280
"peerDependencies": {
7381
"react": ">=16.13.1"
7482
},
75-
"eslintConfig": {
76-
"extends": "./node_modules/kcd-scripts/eslint.js",
77-
"rules": {
78-
"react/prop-types": "off",
79-
"react/no-did-update-set-state": "off",
80-
"babel/no-unused-expressions": "off"
81-
}
82-
},
8383
"preconstruct": {
8484
"exports": {
8585
"importConditionDefaultExport": "default"

0 commit comments

Comments
 (0)