-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unified linting file and added linting pipeline
- Loading branch information
1 parent
8e69f22
commit 6cf0ec0
Showing
6 changed files
with
85 additions
and
47 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,40 @@ | ||
name: Lint Code | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
# Sets up Node.js environment | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20' | ||
|
||
# Installs dependencies | ||
- name: Install dependencies | ||
run: npm install | ||
|
||
# Runs ESLint | ||
- name: Run ESLint | ||
run: npx eslint --fix ./src | ||
|
||
# Displays result | ||
- name: Check for ESLint errors | ||
run: | | ||
if npx eslint --fix ./src; then | ||
echo "Linting passed!" | ||
else | ||
echo "Linting failed!" | ||
exit 1 | ||
fi |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,45 @@ | ||
import eslint from '@eslint/js'; | ||
import tseslint from 'typescript-eslint'; | ||
import typescriptParser from '@typescript-eslint/parser'; | ||
import stylisticJs from '@stylistic/eslint-plugin-js'; | ||
|
||
export default [ | ||
eslint.configs.recommended, | ||
...tseslint.configs.recommended, | ||
{ | ||
ignores: ['dist', 'node_modules'], | ||
plugins: { | ||
'@stylistic/js': stylisticJs, | ||
}, | ||
languageOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 2024, | ||
parser: typescriptParser | ||
}, | ||
rules: { | ||
'strict': 'error', | ||
'no-var': 'error', | ||
'array-callback-return': 'error', | ||
'yoda': 'error', | ||
'@stylistic/js/indent': [ | ||
'error', | ||
4, | ||
], | ||
'@stylistic/js/linebreak-style': [ | ||
'error', | ||
'unix' | ||
], | ||
'@stylistic/js/quotes': [ | ||
'error', | ||
'double' | ||
], | ||
'@stylistic/js/semi': [ | ||
'error', | ||
'always' | ||
], | ||
'@typescript-eslint/no-unused-vars': 'error', | ||
'@typescript-eslint/ban-ts-comment': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off' | ||
} | ||
} | ||
]; |