Skip to content

Commit

Permalink
fix: lint with latest rules
Browse files Browse the repository at this point in the history
  • Loading branch information
belgattitude committed Oct 20, 2024
1 parent 4ae6f9e commit a5aecd9
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion apps/nextjs-app/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = {
extends: [
'@your-org/eslint-config-bases/typescript',
'@your-org/eslint-config-bases/import-x',
// '@your-org/eslint-config-bases/sonar',
'@your-org/eslint-config-bases/sonar',
'@your-org/eslint-config-bases/regexp',
'@your-org/eslint-config-bases/jest',
'@your-org/eslint-config-bases/react',
Expand All @@ -39,6 +39,7 @@ module.exports = {
// For the sake of example
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md
'jsx-a11y/anchor-is-valid': 'off',
'sonarjs/anchor-is-valid': 'off',
'jsx-a11y/label-has-associated-control': 'off',
},
overrides: [
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"dev": "next",
"fix-all-files": "eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs,.mdx,.graphql --fix",
"flamegraph-home": "npx 0x --output-dir './.debug/flamegraph/{pid}.0x' --on-port 'autocannon http://localhost:$PORT --duration 20' -- node ../../node_modules/.bin/next start",
"lint": "eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs,.mdx,.graphql --cache --cache-location ../../.cache/eslint/nextjs-app.eslintcache",
"lint": "TIMING=1 eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs,.mdx,.graphql --cache --cache-location ../../.cache/eslint/nextjs-app.eslintcache",
"start": "next start",
"test": "yarn test-unit",
"test-e2e": "cross-env E2E_WEBSERVER_MODE=BUILD_AND_START playwright test",
Expand Down
1 change: 0 additions & 1 deletion apps/nextjs-app/src/config/build-env.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const isProd = process.env.NODE_ENV === 'production';
const falseOnCi = !isCI;

/**
* @todo working with jsdoc/mjs is limited, see later on how to improve this
* @satisfies { Record<`NEXT_BUILD_ENV_${string}`, import('zod').ZodSchema> }
*/
const schema = {
Expand Down
1 change: 0 additions & 1 deletion apps/nextjs-app/src/layouts/admin/AdminSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { FC } from 'react';
import { TextAvatar } from '@/components/avatar/TextAvatar';

export const AdminSidebar: FC = () => {
// @todo better to use middleware or https://next-auth.js.org/getting-started/client#custom-client-session-handling
// const { data: session, status } = useSession();
const { data: session } = useSession();
const user = session?.user;
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs-app/src/lib/env/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pc from 'picocolors';
import { z } from 'zod';

const isRunningInNode = process !== undefined;
const isRunningInNode = process != undefined;
const isTestEnv = process.env.NODE_ENV === 'test';

export const truthyStrEnvValue = ['true', '1'];
Expand Down
5 changes: 5 additions & 0 deletions packages/eslint-config-bases/src/bases/sonar.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ module.exports = {
excludedFiles: filePatterns.nonCodeFile,
files: filePatterns.anyCode,
rules: {
// better handled by jsx-a11y plugin
'sonarjs/anchor-is-valid': 'off',
'sonarjs/label-has-associated-control': 'off',
// Typescript-eslint does the job well enough
'sonarjs/no-misused-promises': 'off',
// Because plugin unused-import does it better (autofix)
Expand All @@ -28,6 +31,8 @@ module.exports = {
'sonarjs/sonar-no-unused-vars': 'off',
// because it's handled by typescript-eslint
'sonarjs/deprecation': 'off',
// it makes too much noise
'sonarjs/sonar-prefer-read-only-props': 'off',
// because it doesn't play well with exactOptionalTypes
'sonarjs/no-redundant-optional': 'off',
'sonarjs/jsx-no-useless-fragment': 'off',
Expand Down

0 comments on commit a5aecd9

Please sign in to comment.