Skip to content

Commit d78550c

Browse files
authored
templates: fix build by reducing strictness of eslint rules (#9943)
1 parent c7272bb commit d78550c

File tree

11 files changed

+223
-66
lines changed

11 files changed

+223
-66
lines changed

templates/_template/eslint.config.mjs

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
1-
import { dirname } from "path";
2-
import { fileURLToPath } from "url";
3-
import { FlatCompat } from "@eslint/eslintrc";
1+
import { dirname } from 'path'
2+
import { fileURLToPath } from 'url'
3+
import { FlatCompat } from '@eslint/eslintrc'
44

5-
const __filename = fileURLToPath(import.meta.url);
6-
const __dirname = dirname(__filename);
5+
const __filename = fileURLToPath(import.meta.url)
6+
const __dirname = dirname(__filename)
77

88
const compat = new FlatCompat({
99
baseDirectory: __dirname,
10-
});
10+
})
1111

1212
const eslintConfig = [
13-
...compat.extends("next/core-web-vitals", "next/typescript"),
14-
];
13+
...compat.extends('next/core-web-vitals', 'next/typescript'),
14+
{
15+
rules: {
16+
'@typescript-eslint/ban-ts-comment': 'warn',
17+
'@typescript-eslint/no-empty-object-type': 'warn',
18+
'@typescript-eslint/no-explicit-any': 'warn',
19+
'@typescript-eslint/no-unused-vars': [
20+
'warn',
21+
{
22+
vars: 'all',
23+
args: 'after-used',
24+
ignoreRestSiblings: false,
25+
argsIgnorePattern: '^_',
26+
varsIgnorePattern: '^_',
27+
destructuredArrayIgnorePattern: '^_',
28+
caughtErrorsIgnorePattern: '^(_|ignore)',
29+
},
30+
],
31+
},
32+
},
33+
]
1534

16-
export default eslintConfig;
35+
export default eslintConfig

templates/blank/eslint.config.mjs

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
1-
import { dirname } from "path";
2-
import { fileURLToPath } from "url";
3-
import { FlatCompat } from "@eslint/eslintrc";
1+
import { dirname } from 'path'
2+
import { fileURLToPath } from 'url'
3+
import { FlatCompat } from '@eslint/eslintrc'
44

5-
const __filename = fileURLToPath(import.meta.url);
6-
const __dirname = dirname(__filename);
5+
const __filename = fileURLToPath(import.meta.url)
6+
const __dirname = dirname(__filename)
77

88
const compat = new FlatCompat({
99
baseDirectory: __dirname,
10-
});
10+
})
1111

1212
const eslintConfig = [
13-
...compat.extends("next/core-web-vitals", "next/typescript"),
14-
];
13+
...compat.extends('next/core-web-vitals', 'next/typescript'),
14+
{
15+
rules: {
16+
'@typescript-eslint/ban-ts-comment': 'warn',
17+
'@typescript-eslint/no-empty-object-type': 'warn',
18+
'@typescript-eslint/no-explicit-any': 'warn',
19+
'@typescript-eslint/no-unused-vars': [
20+
'warn',
21+
{
22+
vars: 'all',
23+
args: 'after-used',
24+
ignoreRestSiblings: false,
25+
argsIgnorePattern: '^_',
26+
varsIgnorePattern: '^_',
27+
destructuredArrayIgnorePattern: '^_',
28+
caughtErrorsIgnorePattern: '^(_|ignore)',
29+
},
30+
],
31+
},
32+
},
33+
]
1534

16-
export default eslintConfig;
35+
export default eslintConfig

templates/blank/pnpm-lock.yaml

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

templates/website/eslint.config.mjs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,27 @@ const compat = new FlatCompat({
99
baseDirectory: __dirname,
1010
})
1111

12-
const eslintConfig = [...compat.extends('next/core-web-vitals', 'next/typescript')]
12+
const eslintConfig = [
13+
...compat.extends('next/core-web-vitals', 'next/typescript'),
14+
{
15+
rules: {
16+
'@typescript-eslint/ban-ts-comment': 'warn',
17+
'@typescript-eslint/no-empty-object-type': 'warn',
18+
'@typescript-eslint/no-explicit-any': 'warn',
19+
'@typescript-eslint/no-unused-vars': [
20+
'warn',
21+
{
22+
vars: 'all',
23+
args: 'after-used',
24+
ignoreRestSiblings: false,
25+
argsIgnorePattern: '^_',
26+
varsIgnorePattern: '^_',
27+
destructuredArrayIgnorePattern: '^_',
28+
caughtErrorsIgnorePattern: '^(_|ignore)',
29+
},
30+
],
31+
},
32+
},
33+
]
1334

1435
export default eslintConfig

templates/website/src/utilities/generatePreviewPath.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const generatePreviewPath = ({ collection, slug, req }: Props) => {
3030
process.env.NODE_ENV === 'production' || Boolean(process.env.VERCEL_PROJECT_PRODUCTION_URL)
3131
const protocol = isProduction ? 'https:' : req.protocol
3232

33-
let url = `${protocol}//${req.host}/next/preview?${encodedParams.toString()}`
33+
const url = `${protocol}//${req.host}/next/preview?${encodedParams.toString()}`
3434

3535
return url
3636
}
Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
1-
import { dirname } from "path";
2-
import { fileURLToPath } from "url";
3-
import { FlatCompat } from "@eslint/eslintrc";
1+
import { dirname } from 'path'
2+
import { fileURLToPath } from 'url'
3+
import { FlatCompat } from '@eslint/eslintrc'
44

5-
const __filename = fileURLToPath(import.meta.url);
6-
const __dirname = dirname(__filename);
5+
const __filename = fileURLToPath(import.meta.url)
6+
const __dirname = dirname(__filename)
77

88
const compat = new FlatCompat({
99
baseDirectory: __dirname,
10-
});
10+
})
1111

1212
const eslintConfig = [
13-
...compat.extends("next/core-web-vitals", "next/typescript"),
14-
];
13+
...compat.extends('next/core-web-vitals', 'next/typescript'),
14+
{
15+
rules: {
16+
'@typescript-eslint/ban-ts-comment': 'warn',
17+
'@typescript-eslint/no-empty-object-type': 'warn',
18+
'@typescript-eslint/no-explicit-any': 'warn',
19+
'@typescript-eslint/no-unused-vars': [
20+
'warn',
21+
{
22+
vars: 'all',
23+
args: 'after-used',
24+
ignoreRestSiblings: false,
25+
argsIgnorePattern: '^_',
26+
varsIgnorePattern: '^_',
27+
destructuredArrayIgnorePattern: '^_',
28+
caughtErrorsIgnorePattern: '^(_|ignore)',
29+
},
30+
],
31+
},
32+
},
33+
]
1534

16-
export default eslintConfig;
35+
export default eslintConfig
Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
1-
import { dirname } from "path";
2-
import { fileURLToPath } from "url";
3-
import { FlatCompat } from "@eslint/eslintrc";
1+
import { dirname } from 'path'
2+
import { fileURLToPath } from 'url'
3+
import { FlatCompat } from '@eslint/eslintrc'
44

5-
const __filename = fileURLToPath(import.meta.url);
6-
const __dirname = dirname(__filename);
5+
const __filename = fileURLToPath(import.meta.url)
6+
const __dirname = dirname(__filename)
77

88
const compat = new FlatCompat({
99
baseDirectory: __dirname,
10-
});
10+
})
1111

1212
const eslintConfig = [
13-
...compat.extends("next/core-web-vitals", "next/typescript"),
14-
];
13+
...compat.extends('next/core-web-vitals', 'next/typescript'),
14+
{
15+
rules: {
16+
'@typescript-eslint/ban-ts-comment': 'warn',
17+
'@typescript-eslint/no-empty-object-type': 'warn',
18+
'@typescript-eslint/no-explicit-any': 'warn',
19+
'@typescript-eslint/no-unused-vars': [
20+
'warn',
21+
{
22+
vars: 'all',
23+
args: 'after-used',
24+
ignoreRestSiblings: false,
25+
argsIgnorePattern: '^_',
26+
varsIgnorePattern: '^_',
27+
destructuredArrayIgnorePattern: '^_',
28+
caughtErrorsIgnorePattern: '^(_|ignore)',
29+
},
30+
],
31+
},
32+
},
33+
]
1534

16-
export default eslintConfig;
35+
export default eslintConfig
Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
1-
import { dirname } from "path";
2-
import { fileURLToPath } from "url";
3-
import { FlatCompat } from "@eslint/eslintrc";
1+
import { dirname } from 'path'
2+
import { fileURLToPath } from 'url'
3+
import { FlatCompat } from '@eslint/eslintrc'
44

5-
const __filename = fileURLToPath(import.meta.url);
6-
const __dirname = dirname(__filename);
5+
const __filename = fileURLToPath(import.meta.url)
6+
const __dirname = dirname(__filename)
77

88
const compat = new FlatCompat({
99
baseDirectory: __dirname,
10-
});
10+
})
1111

1212
const eslintConfig = [
13-
...compat.extends("next/core-web-vitals", "next/typescript"),
14-
];
13+
...compat.extends('next/core-web-vitals', 'next/typescript'),
14+
{
15+
rules: {
16+
'@typescript-eslint/ban-ts-comment': 'warn',
17+
'@typescript-eslint/no-empty-object-type': 'warn',
18+
'@typescript-eslint/no-explicit-any': 'warn',
19+
'@typescript-eslint/no-unused-vars': [
20+
'warn',
21+
{
22+
vars: 'all',
23+
args: 'after-used',
24+
ignoreRestSiblings: false,
25+
argsIgnorePattern: '^_',
26+
varsIgnorePattern: '^_',
27+
destructuredArrayIgnorePattern: '^_',
28+
caughtErrorsIgnorePattern: '^(_|ignore)',
29+
},
30+
],
31+
},
32+
},
33+
]
1534

16-
export default eslintConfig;
35+
export default eslintConfig
Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
1-
import { dirname } from "path";
2-
import { fileURLToPath } from "url";
3-
import { FlatCompat } from "@eslint/eslintrc";
1+
import { dirname } from 'path'
2+
import { fileURLToPath } from 'url'
3+
import { FlatCompat } from '@eslint/eslintrc'
44

5-
const __filename = fileURLToPath(import.meta.url);
6-
const __dirname = dirname(__filename);
5+
const __filename = fileURLToPath(import.meta.url)
6+
const __dirname = dirname(__filename)
77

88
const compat = new FlatCompat({
99
baseDirectory: __dirname,
10-
});
10+
})
1111

1212
const eslintConfig = [
13-
...compat.extends("next/core-web-vitals", "next/typescript"),
14-
];
13+
...compat.extends('next/core-web-vitals', 'next/typescript'),
14+
{
15+
rules: {
16+
'@typescript-eslint/ban-ts-comment': 'warn',
17+
'@typescript-eslint/no-empty-object-type': 'warn',
18+
'@typescript-eslint/no-explicit-any': 'warn',
19+
'@typescript-eslint/no-unused-vars': [
20+
'warn',
21+
{
22+
vars: 'all',
23+
args: 'after-used',
24+
ignoreRestSiblings: false,
25+
argsIgnorePattern: '^_',
26+
varsIgnorePattern: '^_',
27+
destructuredArrayIgnorePattern: '^_',
28+
caughtErrorsIgnorePattern: '^(_|ignore)',
29+
},
30+
],
31+
},
32+
},
33+
]
1534

16-
export default eslintConfig;
35+
export default eslintConfig
Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
1-
import { dirname } from "path";
2-
import { fileURLToPath } from "url";
3-
import { FlatCompat } from "@eslint/eslintrc";
1+
import { dirname } from 'path'
2+
import { fileURLToPath } from 'url'
3+
import { FlatCompat } from '@eslint/eslintrc'
44

5-
const __filename = fileURLToPath(import.meta.url);
6-
const __dirname = dirname(__filename);
5+
const __filename = fileURLToPath(import.meta.url)
6+
const __dirname = dirname(__filename)
77

88
const compat = new FlatCompat({
99
baseDirectory: __dirname,
10-
});
10+
})
1111

1212
const eslintConfig = [
13-
...compat.extends("next/core-web-vitals", "next/typescript"),
14-
];
13+
...compat.extends('next/core-web-vitals', 'next/typescript'),
14+
{
15+
rules: {
16+
'@typescript-eslint/ban-ts-comment': 'warn',
17+
'@typescript-eslint/no-empty-object-type': 'warn',
18+
'@typescript-eslint/no-explicit-any': 'warn',
19+
'@typescript-eslint/no-unused-vars': [
20+
'warn',
21+
{
22+
vars: 'all',
23+
args: 'after-used',
24+
ignoreRestSiblings: false,
25+
argsIgnorePattern: '^_',
26+
varsIgnorePattern: '^_',
27+
destructuredArrayIgnorePattern: '^_',
28+
caughtErrorsIgnorePattern: '^(_|ignore)',
29+
},
30+
],
31+
},
32+
},
33+
]
1534

16-
export default eslintConfig;
35+
export default eslintConfig

templates/with-vercel-website/src/utilities/generatePreviewPath.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const generatePreviewPath = ({ collection, slug, req }: Props) => {
3030
process.env.NODE_ENV === 'production' || Boolean(process.env.VERCEL_PROJECT_PRODUCTION_URL)
3131
const protocol = isProduction ? 'https:' : req.protocol
3232

33-
let url = `${protocol}//${req.host}/next/preview?${encodedParams.toString()}`
33+
const url = `${protocol}//${req.host}/next/preview?${encodedParams.toString()}`
3434

3535
return url
3636
}

0 commit comments

Comments
 (0)