Skip to content

Commit

Permalink
Add eslint to help maintain higher code standards (#315)
Browse files Browse the repository at this point in the history
The most important part of having eslint here is the checks in
`eslint-plugin-react-hooks` which help check some of the most critical
usage patterns when it comes to writing React code.
  • Loading branch information
thieflord06 authored Mar 9, 2025
2 parents c57bdf7 + 7a426bb commit 77aef81
Show file tree
Hide file tree
Showing 18 changed files with 3,056 additions and 241 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/npm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,33 @@ on:
branches: [main, dev]

jobs:
build_and_test:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run build
- run: npm run typecheck
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run eslint
stylelint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run stylelint
25 changes: 25 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import globals from 'globals';
import pluginJs from '@eslint/js';
import pluginReact from 'eslint-plugin-react';
import pluginReactHooks from 'eslint-plugin-react-hooks';

/** @type {import('eslint').Linter.Config[]} */
export default [
{ files: ['**/*.{js,mjs,cjs,jsx}'] },
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
pluginReact.configs.flat.recommended,
pluginReact.configs.flat['jsx-runtime'],
pluginReactHooks.configs['recommended-latest'],
{
settings: {
react: {
version: 'detect',
},
},
rules: {
'react/prop-types': 'off',
'no-unused-vars': 'off',
},
},
];
Loading

0 comments on commit 77aef81

Please sign in to comment.