-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated README.md * Added .gitignore * Added GitHub actions
- Loading branch information
1 parent
66898da
commit b433927
Showing
8 changed files
with
337 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Ensure valid code | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
eslint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
|
||
- name: Run ESLint check | ||
run: npx eslint | ||
|
||
- name: Annotate Pull Request with Results | ||
if: failure() | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: '⚠️ ESLint found issues.' | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Ensure valid codestyle | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
prettier: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
|
||
- name: Run Prettier check | ||
run: npx prettier --check **/*.js | ||
|
||
- name: Annotate Pull Request with Results | ||
if: failure() | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: '⚠️ Prettier found formatting issues. Please run `npx prettier --write **/*.js` to fix them.' | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# See http://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# Compiled output | ||
/dist | ||
/tmp | ||
/out-tsc | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# IDEs and editors | ||
.idea | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
|
||
# misc | ||
.sass-cache | ||
connect.lock | ||
typings | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# next.js build output | ||
.next | ||
|
||
# Lerna | ||
lerna-debug.log | ||
|
||
# System Files | ||
.DS_Store | ||
Thumbs.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"printWidth": 120, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"bracketSpacing": true, | ||
"arrowParens": "avoid" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
export default [ | ||
// Global variables | ||
{ | ||
languageOptions: { | ||
globals: { | ||
console: true, | ||
customElements: true, | ||
document: true, | ||
HTMLElement: true, | ||
}, | ||
}, | ||
}, | ||
|
||
// Global settings | ||
{ | ||
files: ['**/*.js'], | ||
settings: { | ||
react: { | ||
// removes warning "React version not specified in eslint-plugin-react settings" | ||
version: 'detect', | ||
}, | ||
}, | ||
}, | ||
|
||
// Ground rules | ||
{ | ||
// inspired by: | ||
// - https://github.com/eslint/eslint/blob/dd58cd4afa6ced9016c091fc99a702c97a3e44f0/conf/eslint-recommended.js#L14-L74 | ||
// - https://github.com/suchipi/eslint-config-unobtrusive/blob/744a7f23a549c3dcf0a35a0d43372a268af4f028/index.js | ||
rules: { | ||
'constructor-super': 'error', | ||
'for-direction': 'error', | ||
'getter-return': 'error', | ||
'no-case-declarations': 'warn', | ||
'no-class-assign': 'warn', | ||
'no-compare-neg-zero': 'warn', | ||
// https://github.com/suchipi/eslint-config-unobtrusive/blob/744a7f23a549c3dcf0a35a0d43372a268af4f028/index.js#L43-L52 | ||
'no-cond-assign': ['warn', 'except-parens'], | ||
'no-const-assign': 'error', | ||
// https://github.com/suchipi/eslint-config-unobtrusive/blob/744a7f23a549c3dcf0a35a0d43372a268af4f028/index.js#L58-L63 | ||
'no-constant-condition': ['warn', { checkLoops: false }], | ||
'no-debugger': 'warn', | ||
'no-delete-var': 'error', | ||
'no-dupe-args': 'error', | ||
'no-dupe-class-members': 'error', // Note: has a TS extension | ||
'no-dupe-else-if': 'error', | ||
'no-dupe-keys': 'error', | ||
'no-duplicate-case': 'error', | ||
'no-empty-character-class': 'warn', | ||
'no-empty-function': 'warn', // Note: has a TS extension | ||
'no-empty-pattern': 'warn', | ||
'no-ex-assign': 'warn', | ||
'no-func-assign': 'warn', | ||
'no-global-assign': 'error', | ||
'no-import-assign': 'error', | ||
'no-invalid-regexp': 'error', | ||
'no-loss-of-precision': 'warn', // Note: has a TS extension | ||
'no-misleading-character-class': 'warn', | ||
'no-new-native-nonconstructor': 'error', | ||
'no-nonoctal-decimal-escape': 'warn', | ||
'no-obj-calls': 'error', | ||
'no-octal': 'error', | ||
'no-redeclare': 'warn', // Note: has a TS extension | ||
'no-self-assign': 'warn', | ||
'no-setter-return': 'warn', | ||
'no-shadow-restricted-names': 'error', | ||
'no-sparse-arrays': 'warn', | ||
'no-this-before-super': 'error', | ||
'no-undef': 'error', | ||
'no-unexpected-multiline': 'warn', | ||
'no-unreachable': 'warn', | ||
'no-unsafe-finally': 'warn', | ||
'no-unsafe-negation': 'warn', | ||
'no-unsafe-optional-chaining': 'warn', | ||
// typically represents an unfinished assignment | ||
// https://github.com/facebook/create-react-app/blob/a422bf227cf5294a34d68696664e9568a152fd8f/packages/eslint-config-react-app/index.js#L167-L174 | ||
// Note: has a TS extension | ||
'no-unused-expressions': [ | ||
'warn', | ||
{ | ||
allowShortCircuit: true, | ||
allowTernary: true, | ||
allowTaggedTemplates: true, | ||
}, | ||
], | ||
'no-unused-labels': 'warn', | ||
// rest siblings are fine | ||
// https://github.com/facebook/create-react-app/blob/a422bf227cf5294a34d68696664e9568a152fd8f/packages/eslint-config-react-app/index.js#L176-L182 | ||
// Note: has a TS extension | ||
'no-unused-vars': ['warn', { args: 'none', ignoreRestSiblings: true }], | ||
// https://github.com/facebook/create-react-app/blob/a422bf227cf5294a34d68696664e9568a152fd8f/packages/eslint-config-react-app/index.js#L183-L190 | ||
// Note: has TS extension | ||
'no-use-before-define': ['warn', { functions: false, classes: false, variables: false }], | ||
'no-useless-backreference': 'warn', | ||
'no-useless-escape': 'warn', | ||
'no-with': 'error', | ||
'require-yield': 'warn', | ||
'use-isnan': 'warn', | ||
// https://github.com/suchipi/eslint-config-unobtrusive/blob/744a7f23a549c3dcf0a35a0d43372a268af4f028/index.js#L217-L225 | ||
'valid-typeof': ['warn', { requireStringLiterals: false }], | ||
}, | ||
}, | ||
]; |
Oops, something went wrong.