Skip to content

Commit

Permalink
lint(package): upgraded @poolofdeath20/eslint-config
Browse files Browse the repository at this point in the history
  • Loading branch information
GervinFung committed Sep 21, 2024
1 parent 904f313 commit db8ef3f
Show file tree
Hide file tree
Showing 5 changed files with 345 additions and 377 deletions.
2 changes: 1 addition & 1 deletion apps/web/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ format-write:

## lint
lint:
pnpm eslint --ignore-path .gitignore --ext .mjs,.tsx,.ts --color && pnpm knip
pnpm eslint . --color && pnpm knip

## typecheck
typecheck:
Expand Down
71 changes: 23 additions & 48 deletions apps/web/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,65 +1,40 @@
import process from 'process';
import eslint from '@eslint/js';

import { includeIgnoreFile } from '@eslint/compat';
import eslint from '@eslint/js';
import { node, next } from '@poolofdeath20/eslint-config';
import tseslint from 'typescript-eslint';

const allowedFor = ['SyntaxHighlighter', 'Image'];

export default tseslint.config(
// @ts-expect-error: type mismatch between eslint and eslint-compat
includeIgnoreFile(`${process.cwd()}/.gitignore`),
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.strict,
...tseslint.configs.stylistic,
node,
{
files: ['script/mongo-setup/document.js'],
rules: {
'no-undef': 'off',
},
extends: [tseslint.configs.disableTypeChecked],
},
{
settings: {
react: {
version: 'detect',
},
},
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
...next,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
rules: {
'@typescript-eslint/array-type': [
'error',
{
default: 'generic',
},
],
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^ignore',
destructuredArrayIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
'react/prop-types': 'off',
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],
'arrow-body-style': ['error', 'always'],
'no-restricted-syntax': [
...next.rules,
'react/jsx-child-element-spacing': 'off',
'react/forbid-component-props': [
'error',
{
selector: 'TSEnumDeclaration',
message: "Don't declare enums",
forbid: [
{
propName: 'style',
allowedFor,
message: `Props "style" is forbidden for all components except ${allowedFor
.map((component) => {
return `"${component}"`;
})
.join(', ')}`,
},
],
},
],
},
Expand Down
8 changes: 4 additions & 4 deletions apps/web/knip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ const config: KnipConfig = {
'src/**/*.ts',
'script/**/*.ts',
],
ignore: ['next-sitemap.config.js', 'public/**.js'],
ignoreBinaries: ['make', 'puppeteer/install.mjs'],
ignore: ['next-sitemap.config.js'],
ignoreBinaries: ['make'],
ignoreDependencies: [
'vite-node',
'eslint',
'next-sitemap',
'prettier',
'eslint',
'supabase',
'vite-node',
],
};

Expand Down
4 changes: 2 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@ducanh2912/next-pwa": "^10.2.8",
"@eslint/compat": "^1.1.1",
"@eslint/js": "^9.8.0",
"@poolofdeath20/eslint-config": "^0.3.4",
"@poolofdeath20/eslint-config": "^0.4.0",
"@poolofdeath20/tsconfig": "^0.1.1",
"@types/cors": "^2.8.17",
"@types/eslint__js": "^8.42.3",
Expand All @@ -58,7 +58,7 @@
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"ci-info": "^4.0.0",
"eslint": "^9.8.0",
"eslint": "^9.9.1",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-react": "^7.35.0",
"gen-env-type-def": "^0.0.4",
Expand Down
Loading

0 comments on commit db8ef3f

Please sign in to comment.