Skip to content

Commit ea086bd

Browse files
author
Strek
authored
Fixing Eslint configuration (#4087)
* fix-collapsable-color * Made Eslint work and added next's eslint config * Add lint:fix to pre commit rule * Reverts older anchor links * Fixed review comments * Replace with spaces like before * Update DocsFooter.tsx * Update arrow function * Update CodeBlock.tsx * Update MDXComponents.tsx * Update SidebarLink.tsx
1 parent 4022f97 commit ea086bd

File tree

9 files changed

+459
-395
lines changed

9 files changed

+459
-395
lines changed

beta/.eslintrc

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
{
2-
"extends": ["react-app", "plugin:jsx-a11y/recommended"],
3-
"plugins": ["jsx-a11y"],
4-
"overrides": [
5-
{
6-
"files": ["**/*.ts?(x)"],
7-
"rules": {
8-
"jsx-a11y/anchor-is-valid": 0
9-
}
10-
}
11-
],
2+
"root": true,
3+
"extends": "next",
124
"env": {
135
"node": true,
146
"commonjs": true,
157
"browser": true,
168
"es6": true
179
}
18-
}
10+
}

beta/.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
cd beta
55
yarn generate-ids
66
git add -u src/pages/**/*.md
7+
yarn lint:fix

beta/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"analyze": "ANALYZE=true next build",
88
"dev": "next",
99
"build": "next build && node ./scripts/generateRSS.js",
10-
"lint": "eslint 'src/**/*.{js,ts,tsx}'",
10+
"lint": "next lint",
11+
"lint:fix": "next lint --fix",
1112
"format:source": "prettier --config .prettierrc --write \"{plugins,src}/**/*.{js,ts,jsx,tsx}\"",
1213
"nit:source": "prettier --config .prettierrc --list-different \"{plugins,src}/**/*.{js,ts,jsx,tsx}\"",
1314
"prettier": "yarn format:source",
@@ -52,7 +53,8 @@
5253
"asyncro": "^3.0.0",
5354
"autoprefixer": "^10.3.1",
5455
"babel-eslint": "10.x",
55-
"eslint": "6.x",
56+
"eslint": "7.x",
57+
"eslint-config-next": "12.0.3",
5658
"eslint-config-react-app": "^5.2.1",
5759
"eslint-plugin-flowtype": "4.x",
5860
"eslint-plugin-import": "2.x",

beta/src/components/Layout/Nav/NavButtonLink.tsx

Lines changed: 0 additions & 39 deletions
This file was deleted.

beta/src/components/MDX/CodeBlock/CodeBlock.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ interface InlineHiglight {
2121
endColumn: number;
2222
}
2323

24-
const CodeBlock = React.forwardRef(
24+
const CodeBlock = React.forwardRef(function CodeBlock
2525
(
2626
{
2727
children,
@@ -37,7 +37,7 @@ const CodeBlock = React.forwardRef(
3737
noMarkers?: boolean;
3838
},
3939
ref?: React.Ref<HTMLDivElement>
40-
) => {
40+
) {
4141
const getDecoratedLineInfo = () => {
4242
if (!metastring) {
4343
return [];

beta/src/components/MDX/Link.tsx

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,20 @@ function Link({
3434
return (
3535
<>
3636
{href.startsWith('https://') ? (
37-
<ExternalLink
38-
href={href}
39-
className={cn(classes, className)}
40-
{...props}
41-
children={modifiedChildren}
42-
/>
37+
<ExternalLink href={href} className={cn(classes, className)} {...props}>
38+
{modifiedChildren}
39+
</ExternalLink>
4340
) : href.startsWith('#') ? (
4441
// eslint-disable-next-line jsx-a11y/anchor-has-content
45-
<a
46-
className={cn(classes, className)}
47-
href={href}
48-
{...props}
49-
children={modifiedChildren}
50-
/>
42+
<a className={cn(classes, className)} href={href} {...props}>
43+
{modifiedChildren}
44+
</a>
5145
) : (
5246
<NextLink href={href.replace('.html', '')}>
5347
{/* eslint-disable-next-line jsx-a11y/anchor-has-content */}
54-
<a
55-
className={cn(classes, className)}
56-
{...props}
57-
children={modifiedChildren}
58-
/>
48+
<a className={cn(classes, className)} {...props}>
49+
{modifiedChildren}
50+
</a>
5951
</NextLink>
6052
)}
6153
</>

beta/src/components/MDX/MDXComponents.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ function IllustrationBlock({
234234
) : null}
235235
{sequential ? (
236236
<ol className="mdx-illustration-block flex">
237-
{images.map((x: any) => (
238-
<li className="flex-1">{x}</li>
237+
{images.map((x: any, i: number) => (
238+
<li className="flex-1" key={i}>{x}</li>
239239
))}
240240
</ol>
241241
) : (

beta/tsconfig.json

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"compilerOptions": {
33
"target": "es5",
4-
"lib": ["dom", "dom.iterable", "esnext"],
4+
"lib": [
5+
"dom",
6+
"dom.iterable",
7+
"esnext"
8+
],
59
"allowJs": true,
610
"skipLibCheck": true,
711
"strict": true,
@@ -17,8 +21,15 @@
1721
"resolveJsonModule": true,
1822
"isolatedModules": true,
1923
"jsx": "preserve",
20-
"baseUrl": "src"
24+
"baseUrl": "src",
25+
"incremental": true
2126
},
22-
"include": ["next-env.d.ts", "src/**/*.ts", "src/**/*.tsx"],
23-
"exclude": ["node_modules"]
27+
"include": [
28+
"next-env.d.ts",
29+
"src/**/*.ts",
30+
"src/**/*.tsx"
31+
],
32+
"exclude": [
33+
"node_modules"
34+
]
2435
}

0 commit comments

Comments
 (0)