Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup eslint #307

Merged
merged 4 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/codeanalysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Code analysis

on:
pull_request:
branches:
- develop
- main
types: [ready_for_review, synchronize, opened, reopened]

jobs:
lint:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
name: Lint

strategy:
matrix:
node-version: [21.x]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3

- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
run: npm install

- name: Build site
run: npm run build

- name: Lint Code
run: npm run lint

40 changes: 40 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginReact from "eslint-plugin-react";

export default [
{
files: ["src/*.{js,mjs,cjs,ts,jsx,tsx}"],
},
{
languageOptions:
{
globals: { ...globals.browser, ...globals.node }
},
},
{
settings: {
react: {
version: '18.2',
},
},
},
{
ignores: ["src/components/ui/*", "src/components/svgs/*", "build/"],
thePeras marked this conversation as resolved.
Show resolved Hide resolved
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
{
rules: {
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-require-imports': 'off',
'no-console': ['error', { allow: ["error", "warn", "debug"] }]
}
},
];
Loading
Loading