Skip to content

Commit 75e243f

Browse files
fix: eslint and prettier configuration (#17)
1 parent 537617e commit 75e243f

File tree

6 files changed

+82
-25
lines changed

6 files changed

+82
-25
lines changed

docs/.prettierrc.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default {
2+
singleQuote: true,
3+
trailingComma: 'all',
4+
plugins: ['prettier-plugin-organize-imports'],
5+
};

docs/eslint.config.mjs

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import eslint from '@eslint/js';
22
import prettierRecommended from 'eslint-plugin-prettier/recommended';
3-
import next from "@next/eslint-plugin-next";
4-
import { fixupConfigRules } from "@eslint/compat";
5-
import tsEslint from "typescript-eslint";
3+
import next from '@next/eslint-plugin-next';
4+
import { fixupConfigRules } from '@eslint/compat';
5+
import tsEslint from 'typescript-eslint';
66
import { FlatCompat } from '@eslint/eslintrc';
77
import path from 'path';
88
import { fileURLToPath } from 'url';
@@ -12,7 +12,7 @@ const __filename = fileURLToPath(import.meta.url);
1212
const __dirname = path.dirname(__filename);
1313

1414
const compat = new FlatCompat({
15-
baseDirectory: __dirname, // optional; default: process.cwd()
15+
baseDirectory: __dirname,
1616
});
1717

1818
const tsConfig = (
@@ -21,7 +21,7 @@ const tsConfig = (
2121

2222
const nextConfig = (
2323
fixupConfigRules(
24-
(compat.config(next.configs["core-web-vitals"])),
24+
(compat.config(next.configs['core-web-vitals'])),
2525
)
2626
);
2727

@@ -32,16 +32,18 @@ export default [
3232
prettierRecommended,
3333
{
3434
ignores: [
35-
".*.?(c|m)js",
36-
"*.setup*.?(c|m)js",
37-
"*.config*.?(c|m)js",
38-
"*.d.ts",
39-
".turbo/",
40-
".git/",
41-
"build/",
42-
"dist/",
43-
"coverage/",
44-
"node_modules/",
35+
'.*.?(c|m)js',
36+
'*.setup*.?(c|m)js',
37+
'*.config*.?(c|m)js',
38+
'*.d.ts',
39+
'.turbo/',
40+
'.git/',
41+
'build/',
42+
'dist/',
43+
'coverage/',
44+
'node_modules/',
45+
'.next/',
46+
'public/',
4547
],
4648
},
4749
),
@@ -53,11 +55,41 @@ export default [
5355
React: true,
5456
JSX: true,
5557
},
58+
parserOptions: {
59+
ecmaVersion: 'latest',
60+
sourceType: 'module',
61+
ecmaFeatures: {
62+
jsx: true,
63+
},
64+
},
5665
},
5766
rules: {
58-
"@typescript-eslint/array-type": "off",
59-
"@typescript-eslint/consistent-type-definitions": "off",
60-
"@typescript-eslint/no-empty-function": "off",
67+
// TypeScript specific rules
68+
'@typescript-eslint/array-type': 'off',
69+
'@typescript-eslint/consistent-type-definitions': 'off',
70+
'@typescript-eslint/no-empty-function': 'off',
71+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
72+
'@typescript-eslint/no-explicit-any': 'warn',
73+
'@typescript-eslint/explicit-function-return-type': 'off',
74+
'@typescript-eslint/explicit-module-boundary-types': 'off',
75+
76+
// React specific rules
77+
'react/react-in-jsx-scope': 'off',
78+
'react/prop-types': 'off',
79+
'react/display-name': 'off',
80+
81+
// Next.js specific rules
82+
'@next/next/no-html-link-for-pages': 'error',
83+
'@next/next/no-img-element': 'warn',
84+
'@next/next/no-unwanted-polyfillio': 'error',
85+
86+
// General rules
87+
'no-console': ['warn', { allow: ['warn', 'error'] }],
88+
'no-debugger': 'warn',
89+
'no-duplicate-imports': 'error',
90+
'no-unused-expressions': 'error',
91+
'prefer-const': 'warn',
92+
'no-var': 'error',
6193
},
6294
},
6395
];

docs/mdx-components.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useMDXComponents as getDocsMDXComponents } from "nextra-theme-docs";
1+
import { useMDXComponents as getDocsMDXComponents } from 'nextra-theme-docs';
22

33
const docsComponents = getDocsMDXComponents();
44

docs/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"build": "next build",
88
"start": "next start",
99
"postbuild": "pagefind --site .next/server/app --output-path out/_pagefind",
10+
"format": "prettier --write \"*.{ts,tsx,js,jsx}\"",
1011
"lint": "eslint \"*.{ts,tsx,js,jsx}\" --fix"
1112
},
1213
"dependencies": {
@@ -32,6 +33,7 @@
3233
"eslint-config-prettier": "^10.1.5",
3334
"eslint-plugin-prettier": "^5.4.1",
3435
"pagefind": "^1.3.0",
36+
"prettier-plugin-organize-imports": "^4.1.0",
3537
"typescript": "^5.8.3",
3638
"typescript-eslint": "^8.34.0"
3739
},

docs/pnpm-lock.yaml

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/tailwind.config.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import type { Config } from "tailwindcss";
1+
import type { Config } from 'tailwindcss';
22

33
export default {
44
content: [
5-
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
6-
"./components/**/*.{js,ts,jsx,tsx,mdx}",
7-
"./app/**/*.{js,ts,jsx,tsx,mdx}",
5+
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
6+
'./components/**/*.{js,ts,jsx,tsx,mdx}',
7+
'./app/**/*.{js,ts,jsx,tsx,mdx}',
88
],
99
theme: {
1010
extend: {
1111
colors: {
12-
background: "var(--background)",
13-
foreground: "var(--foreground)",
12+
background: 'var(--background)',
13+
foreground: 'var(--foreground)',
1414
},
1515
},
1616
},

0 commit comments

Comments
 (0)