Skip to content

Commit

Permalink
ci(eslint): use eslint+prettier with ci strictly (#165)
Browse files Browse the repository at this point in the history
* ci(eslint): use eslint+prettier with ci strictly
* Fixed all warnings

---------

Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
  • Loading branch information
manudeli and bvaughn committed Dec 15, 2023
1 parent 54a2838 commit ed6d112
Show file tree
Hide file tree
Showing 13 changed files with 1,727 additions and 116 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
35 changes: 35 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
},
extends: [
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
],
overrides: [
{
env: {
node: true,
},
files: [".eslintrc.{js,cjs}"],
parserOptions: {
sourceType: "script",
},
},
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["react"],
rules: {
"react/no-did-update-set-state": "off",
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"@typescript-eslint/no-explicit-any": "off",
},
};
23 changes: 14 additions & 9 deletions .github/workflows/jest.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
name: "Jest unit tests"
on: [pull_request]
name: CI

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
tests-e2e:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
command: ['pnpm lint', 'pnpm typescript', 'pnpm test']
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
Expand All @@ -13,9 +20,7 @@ jobs:
cache: "pnpm"
cache-dependency-path: "pnpm-lock.yaml"
node-version-file: ".nvmrc"
- name: Install dependencies
run: pnpm install
- name: Build NPM packages
run: pnpm run prerelease
- name: Run tests
run: pnpm run test
- run: pnpm install --frozen-lockfile
- run: pnpm prerelease
- name: Run cis
run: ${{ matrix.command }}
21 changes: 0 additions & 21 deletions .github/workflows/prettier.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/typescript.yml

This file was deleted.

9 changes: 8 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": false
"singleQuote": false,
"arrowParens": "always",
"bracketSameLine": false,
"bracketSpacing": true,
"endOfLine": "lf",
"jsxSingleQuote": false,
"proseWrap": "preserve",
"quoteProps": "as-needed"
}
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"clear:builds": "rm -rf ./dist",
"clear:node_modules": "rm -rf ./node_modules",
"prerelease": "preconstruct build",
"prettier": "prettier --write \"**/*.{css,html,js,json,jsx,ts,tsx}\"",
"prettier:ci": "prettier --check \"**/*.{css,html,js,json,jsx,ts,tsx}\"",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "jest",
"test:watch": "jest --watch",
"typescript": "tsc --noEmit",
Expand All @@ -58,12 +58,20 @@
"@babel/preset-env": "^7.22.5",
"@babel/preset-typescript": "^7.21.5",
"@preconstruct/cli": "^2.8.1",
"@types/assert": "^1.5.10",
"@types/jest": "^26.0.15",
"@types/react": "^18",
"@types/react-dom": "^18",
"@typescript-eslint/eslint-plugin": "^5.52.0",
"assert": "^2.0.0",
"eslint": "^8.0.1",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.1",
"jest": "^29.4.3",
"jest-environment-jsdom": "^29.4.3",
"prettier": "^2.8.6",
"prettier": "^3.0.1",
"react": "^18",
"react-dom": "^18",
"ts-jest": "^29.0.5",
Expand All @@ -72,14 +80,6 @@
"peerDependencies": {
"react": ">=16.13.1"
},
"eslintConfig": {
"extends": "./node_modules/kcd-scripts/eslint.js",
"rules": {
"react/prop-types": "off",
"react/no-did-update-set-state": "off",
"babel/no-unused-expressions": "off"
}
},
"preconstruct": {
"exports": {
"importConditionDefaultExport": "default"
Expand Down
Loading

0 comments on commit ed6d112

Please sign in to comment.