Skip to content
Merged

fix #111

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
26 changes: 5 additions & 21 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,14 @@
{
"extends": [
"next/core-web-vitals",
"next/typescript"
],
"extends": ["next/core-web-vitals", "next/typescript", "prettier"],
"plugins": ["prettier"],
"rules": {
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"react/no-unescaped-entities": "warn",
"react/display-name": "warn",
"@typescript-eslint/ban-ts-comment": "warn",
"@typescript-eslint/no-unsafe-function-type": "warn",
"@typescript-eslint/no-unused-expressions": "warn"
}
}
{
"extends": [
"next/core-web-vitals",
"next/typescript",
"prettier"
],
"plugins": [
"prettier"
],
"rules": {
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-expressions": "warn",
"prettier/prettier": "error"
}
}
45 changes: 45 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import { FlatCompat } from '@eslint/eslintrc';
import prettierPlugin from 'eslint-plugin-prettier';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const compat = new FlatCompat({
baseDirectory: __dirname,
});

const eslintConfig = [
{
ignores: [
'**/*.test.ts',
'**/*.test.tsx',
'**/__tests__/**',
'**/testing/**',
'**/form-management/**/*.test.ts',
'.next/**',
'node_modules/**',
'.eslintignore',
],
},
...compat.extends('next/core-web-vitals', 'next/typescript'),
{
plugins: {
prettier: prettierPlugin,
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'react/no-unescaped-entities': 'warn',
'react/display-name': 'warn',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-unsafe-function-type': 'warn',
'@typescript-eslint/no-unused-expressions': 'warn',
'prettier/prettier': 'error',
'import/no-anonymous-default-export': 'off',
},
},
];

export default eslintConfig;
6 changes: 4 additions & 2 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module.exports = {
const config = {
'*.{js,jsx,ts,tsx}': (filenames) => [
// run eslint --fix on changed files
`eslint --max-warnings=0 --fix ${filenames.join(' ')}`,
// then format with prettier
`prettier --write ${filenames.join(' ')}`,
],
'*.{json,md,css,scss,html}': [`prettier --write ${filenames.join(' ')}`],
'*.{json,md,css,scss,html}': (filenames) => [`prettier --write ${filenames.join(' ')}`],
};

export default config;
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "my-app",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"dev": "next dev --turbopack",
"build": "next build",
Expand Down
2 changes: 0 additions & 2 deletions src/components/i18n/InternationalizationEngine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export function InternationalizationEngine({
children,
}: InternationalizationEngineProps) {
const { language, isLoading, error, changeLanguage } = useInternationalization();
const [preloadStatus, setPreloadStatus] = useState<Record<LanguageCode, boolean>>({} as Record<LanguageCode, boolean>);
const [preloadStatus, setPreloadStatus] = useState<Partial<Record<LanguageCode, boolean>>>({});

// Preload translations on mount
Expand All @@ -55,7 +54,6 @@ export function InternationalizationEngine({
await preloadTranslations(languagesToPreload);

if (!cancelled) {
const status = {} as Record<LanguageCode, boolean>;
const status: Partial<Record<LanguageCode, boolean>> = {};
languagesToPreload.forEach((lang) => {
status[lang] = true;
Expand Down
9 changes: 1 addition & 8 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,13 @@
"noImplicitReturns": true,
"noImplicitAny": false
},
"include": [
"**/*.ts",
"**/*.tsx",
"next-env.d.ts",
".next/types/**/*.ts"
],
"include": ["**/*.ts", "**/*.tsx", "next-env.d.ts", ".next/types/**/*.ts"],
"exclude": [
"node_modules",
".next",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.spec.ts",
"**/*.spec.tsx"
"**/*.test.ts",
"**/*.test.tsx"
]
}
Loading