Skip to content

Commit 6cf0ec0

Browse files
committed
Unified linting file and added linting pipeline
1 parent 8e69f22 commit 6cf0ec0

File tree

6 files changed

+85
-47
lines changed

6 files changed

+85
-47
lines changed

.eslintignore

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

.eslintrc.json

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

.github/workflows/lint.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Lint Code
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
pull_request:
8+
branches:
9+
- '*'
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
18+
# Sets up Node.js environment
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: '20'
23+
24+
# Installs dependencies
25+
- name: Install dependencies
26+
run: npm install
27+
28+
# Runs ESLint
29+
- name: Run ESLint
30+
run: npx eslint --fix ./src
31+
32+
# Displays result
33+
- name: Check for ESLint errors
34+
run: |
35+
if npx eslint --fix ./src; then
36+
echo "Linting passed!"
37+
else
38+
echo "Linting failed!"
39+
exit 1
40+
fi

.prettierignore

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

.prettierrc

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

eslint.config.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import eslint from '@eslint/js';
2+
import tseslint from 'typescript-eslint';
3+
import typescriptParser from '@typescript-eslint/parser';
4+
import stylisticJs from '@stylistic/eslint-plugin-js';
5+
6+
export default [
7+
eslint.configs.recommended,
8+
...tseslint.configs.recommended,
9+
{
10+
ignores: ['dist', 'node_modules'],
11+
plugins: {
12+
'@stylistic/js': stylisticJs,
13+
},
14+
languageOptions: {
15+
sourceType: 'module',
16+
ecmaVersion: 2024,
17+
parser: typescriptParser
18+
},
19+
rules: {
20+
'strict': 'error',
21+
'no-var': 'error',
22+
'array-callback-return': 'error',
23+
'yoda': 'error',
24+
'@stylistic/js/indent': [
25+
'error',
26+
4,
27+
],
28+
'@stylistic/js/linebreak-style': [
29+
'error',
30+
'unix'
31+
],
32+
'@stylistic/js/quotes': [
33+
'error',
34+
'double'
35+
],
36+
'@stylistic/js/semi': [
37+
'error',
38+
'always'
39+
],
40+
'@typescript-eslint/no-unused-vars': 'error',
41+
'@typescript-eslint/ban-ts-comment': 'off',
42+
'@typescript-eslint/no-non-null-assertion': 'off'
43+
}
44+
}
45+
];

0 commit comments

Comments
 (0)