enable automated linting

This commit is contained in:
Thijs van Loef 2025-06-09 23:49:35 +02:00
parent d70396a664
commit 097dafb553
2 changed files with 50 additions and 9 deletions

34
.github/workflows/linting.yml vendored Normal file
View file

@ -0,0 +1,34 @@
name: ESLint Linting
on:
pull_request:
paths:
- '**/*.js'
- '**/*.jsx'
- '**/*.ts'
- '**/*.tsx'
- '.eslintrc*'
- 'package.json'
- 'yarn.lock'
- 'pnpm-lock.yaml'
- 'package-lock.json'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: |
npm ci
- name: Run ESLint
run: |
npx eslint . --ext .js,.jsx,.ts,.tsx

View file

@ -1,12 +1,19 @@
import tseslint from 'typescript-eslint'; import tseslint from 'typescript-eslint';
export default tseslint.config( export default tseslint.config({
tseslint.configs.recommended, files: ["**/*.{ts,tsx,js,jsx}"],
{ languageOptions: {
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"], parser: tseslint.parser,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: {
jsx: true
}
}
},
rules: { rules: {
semi: "error", "semi": "error",
"prefer-const": "error" "prefer-const": "warn"
} }
} });
);