Skip to content

Commit 278fe7c

Browse files
committed
update github actions
1 parent 3868791 commit 278fe7c

File tree

15 files changed

+6146
-1423
lines changed

15 files changed

+6146
-1423
lines changed

.eslintignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
node_modules/
33

44
# Config
5-
webpack.config.js
6-
src/index.tsx
5+
dist

.eslintrc.json

Lines changed: 142 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,153 @@
11
{
22
"env": {
3+
"es2020": true,
34
"browser": true
45
},
5-
"parser": "@babel/eslint-parser",
6-
"parserOptions": {
7-
"ecmaFeatures": {
8-
"jsx": true
9-
},
10-
"sourceType": "module"
11-
},
6+
"parser": "@typescript-eslint/parser",
7+
"extends": [
8+
"react-app",
9+
"prettier",
10+
"standard",
11+
"plugin:@typescript-eslint/recommended",
12+
"plugin:@typescript-eslint/eslint-recommended",
13+
"plugin:import/errors",
14+
"plugin:import/warnings"
15+
],
1216
"settings": {
13-
"react": {
14-
"version": "detect"
17+
"import/parsers": {
18+
"@typescript-eslint/parser": [".ts", ".tsx"]
19+
},
20+
"import/resolver": {
21+
"node": { "extensions": [".js", ".mjs", ".cjs"] },
22+
"typescript": {}
1523
}
1624
},
17-
"extends": [
18-
"eslint:recommended",
19-
"plugin:react/recommended",
20-
"plugin:react-hooks/recommended",
21-
"plugin:import/recommended",
22-
"plugin:prettier/recommended",
23-
"prettier"
24-
],
25+
"plugins": ["@typescript-eslint", "import"],
2526
"rules": {
27+
"react/react-in-jsx-scope": "off",
28+
"react/display-name": "off",
29+
"react/prop-types": "off",
30+
"react/jsx-key": "error",
31+
"no-console": 1,
2632
"no-unused-vars": "off",
27-
"react/prop-types": "off"
33+
"@typescript-eslint/no-unused-vars": [
34+
"error",
35+
{ "vars": "all", "args": "after-used", "ignoreRestSiblings": false }
36+
],
37+
"indent": ["error", 2],
38+
"linebreak-style": ["error", "unix"],
39+
"quotes": ["error", "single"],
40+
"import/newline-after-import": "error",
41+
"import/no-duplicates": "error",
42+
// Enforce import order
43+
"import/order": [
44+
2,
45+
{
46+
"groups": ["builtin", "external", "internal"],
47+
"pathGroups": [
48+
{
49+
"pattern": "react",
50+
"group": "external",
51+
"position": "before"
52+
},
53+
{
54+
"pattern": "@+(symbols)",
55+
"group": "internal"
56+
},
57+
{
58+
"pattern": "@+(api|components|compositions|directives|enums|interfaces|layouts|modules|services|utils|views|hooks)/**",
59+
"group": "internal"
60+
},
61+
{
62+
"pattern": "@/**",
63+
"group": "internal"
64+
},
65+
{
66+
"pattern": "*.scss",
67+
"group": "index",
68+
"patternOptions": { "matchBase": true }
69+
}
70+
],
71+
"pathGroupsExcludedImportTypes": ["react"],
72+
"newlines-between": "always",
73+
"alphabetize": {
74+
"order": "asc",
75+
"caseInsensitive": true
76+
}
77+
}
78+
],
79+
// Imports should come first
80+
"import/first": "error",
81+
// Other import rules
82+
"import/no-mutable-exports": "error",
83+
// Allow unresolved imports
84+
"import/no-unresolved": "off",
85+
86+
"semi": 0,
87+
// "quotes": 0,
88+
// "indent": 0,
89+
"space-before-function-paren": 0,
90+
"arrow-parens": 0,
91+
"comma-dangle": 0,
92+
"keyword-spacing": 0,
93+
"no-multiple-empty-lines": 0,
94+
"no-trailing-spaces": 0,
95+
"unicorn/number-literal-case": 0,
96+
"unicorn/template-indent": 0,
97+
"generator-star-spacing": 0,
98+
"space-infix-ops": 0,
99+
"comma-spacing": 0,
100+
"brace-style": 0,
101+
"space-in-parens": 0,
102+
"space-before-blocks": 0,
103+
"semi-spacing": 0,
104+
"object-property-newline": 0,
105+
"no-multi-spaces": 0,
106+
"key-spacing": 0,
107+
"eol-last": 0,
108+
"func-call-spacing": 0,
109+
"comma-style": 0,
110+
111+
// Disable some unnecessary or conflicting rules
112+
"no-use-before-define": "off",
113+
"unicorn/prevent-abbreviations": 0,
114+
"unicorn/no-await-expression-member": 0,
115+
"unicorn/no-useless-undefined": 0,
116+
"unicorn/no-array-push-push": 0,
117+
"unicorn/filename-case": 0,
118+
"camelcase": 0,
119+
"@typescript-eslint/no-explicit-any": 0,
120+
"@typescript-eslint/no-empty-function": 0,
121+
"@typescript-eslint/no-var-requires": 0,
122+
"@typescript-eslint/ban-ts-comment": 0,
123+
"@typescript-eslint/no-empty-interface": 0,
124+
125+
// Prefer const over let
126+
"prefer-const": [
127+
"error",
128+
{
129+
"destructuring": "any",
130+
"ignoreReadBeforeAssign": false
131+
}
132+
],
133+
134+
// No single if in an "else" block
135+
"no-lonely-if": "error",
136+
137+
// Force curly braces for control flow,
138+
// including if blocks with a single statement
139+
"curly": ["error", "all"],
140+
141+
// No async function without await
142+
"require-await": "error",
143+
144+
// Force dot notation when possible
145+
"dot-notation": "error",
146+
147+
// Force object shorthand where possible
148+
"object-shorthand": "error",
149+
150+
// No useless destructuring/importing/exporting renames
151+
"no-useless-rename": "error"
28152
}
29153
}

.github/workflows/main.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-node@v3
17+
with:
18+
node-version: 18.x
19+
20+
- run: npm install
21+
- run: npm run lint && npm run build

.github/workflows/publish.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
name: Publish
22
on:
3-
push:
4-
branches:
5-
- 'master'
3+
workflow_run:
4+
workflows: ["CI"]
5+
types:
6+
- completed
67

78
concurrency: ${{ github.workflow }}-${{ github.ref }}
89

910
jobs:
10-
build:
11+
publish:
12+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1113
runs-on: ubuntu-latest
1214
steps:
1315
- uses: actions/checkout@v3
1416
- uses: actions/setup-node@v3
1517
with:
16-
node-version: 16
18+
node-version: 18
1719
- run: npm install
20+
- run: npm run build
1821
- name: Create Release Pull Request or Publish
1922
id: changesets
2023
uses: changesets/action@v1

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ node_modules
1111

1212
.nyc_output
1313
coverage
14-
*.lcov
14+
*.lcov
15+
./dist

dist/cjs/index.d.ts

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

dist/cjs/index.js

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

dist/cjs/index.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/esm/index.d.ts

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

dist/esm/index.js

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

0 commit comments

Comments
 (0)