Skip to content

Commit

Permalink
Unified linting file and added linting pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikhanasand committed Dec 15, 2024
1 parent 8e69f22 commit 6cf0ec0
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 47 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

30 changes: 0 additions & 30 deletions .eslintrc.json

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/lint.yml
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
2 changes: 0 additions & 2 deletions .prettierignore

This file was deleted.

13 changes: 0 additions & 13 deletions .prettierrc

This file was deleted.

45 changes: 45 additions & 0 deletions eslint.config.js
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'
}
}
];

0 comments on commit 6cf0ec0

Please sign in to comment.