Skip to content

Commit 1c1ddd5

Browse files
authored
chore: use @sveltejs/eslint-config (#9977)
1 parent ac8123e commit 1c1ddd5

File tree

64 files changed

+556
-302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+556
-302
lines changed

.eslintrc.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
{
2+
"root": true,
3+
"extends": "@sveltejs",
24
"env": {
35
"es2022": true
46
},
5-
"parserOptions": {
6-
"ecmaVersion": "latest",
7-
"sourceType": "module"
8-
},
9-
"plugins": ["unicorn"],
10-
"root": true,
117
"ignorePatterns": ["packages/create-svelte/shared/"],
128
"rules": {
13-
"unicorn/prefer-node-protocol": "error"
9+
"no-undef": "off"
1410
}
1511
}

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@
3131
"@rollup/plugin-commonjs": "^25.0.0",
3232
"@rollup/plugin-json": "^6.0.0",
3333
"@rollup/plugin-node-resolve": "^15.0.1",
34+
"@sveltejs/eslint-config": "^6.0.2",
3435
"@svitejs/changesets-changelog-github-compact": "^1.1.0",
3536
"@typescript-eslint/eslint-plugin": "^5.53.0",
36-
"eslint": "^8.33.0",
37+
"eslint": "^8.40.0",
38+
"eslint-config-prettier": "^8.8.0",
39+
"eslint-plugin-import": "^2.27.5",
40+
"eslint-plugin-svelte": "^2.28.0",
3741
"eslint-plugin-unicorn": "^47.0.0",
3842
"playwright": "1.30.0",
3943
"prettier": "^2.8.0",

packages/adapter-cloudflare/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ export default function (options = {}) {
7171
*/
7272
function get_routes_json(builder, assets, { include = ['/*'], exclude = ['<all>'] }) {
7373
if (!Array.isArray(include) || !Array.isArray(exclude)) {
74-
throw new Error(`routes.include and routes.exclude must be arrays`);
74+
throw new Error('routes.include and routes.exclude must be arrays');
7575
}
7676

7777
if (include.length === 0) {
78-
throw new Error(`routes.include must contain at least one route`);
78+
throw new Error('routes.include must contain at least one route');
7979
}
8080

8181
if (include.length > 100) {
82-
throw new Error(`routes.include must contain 100 or fewer routes`);
82+
throw new Error('routes.include must contain 100 or fewer routes');
8383
}
8484

8585
exclude = exclude

packages/adapter-node/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export default function (opts = {}) {
7171
dir: `${out}/server`,
7272
format: 'esm',
7373
sourcemap: true,
74-
chunkFileNames: `chunks/[name]-[hash].js`
74+
chunkFileNames: 'chunks/[name]-[hash].js'
7575
});
7676

7777
builder.copy(files, out, {

packages/adapter-vercel/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ const plugin = function (defaults = {}) {
224224

225225
if (ignored_isr.size) {
226226
builder.log.warn(
227-
`\nWarning: The following routes have an ISR config which is ignored because the route is prerendered:`
227+
'\nWarning: The following routes have an ISR config which is ignored because the route is prerendered:'
228228
);
229229

230230
for (const ignored of ignored_isr) {
@@ -586,7 +586,7 @@ function validate_vercel_json(builder, vercel_config) {
586586

587587
if (unmatched_paths.length) {
588588
builder.log.warn(
589-
`\nWarning: vercel.json defines cron tasks that use paths that do not correspond to an API route with a GET handler (ignore this if the request is handled in your \`handle\` hook):`
589+
'\nWarning: vercel.json defines cron tasks that use paths that do not correspond to an API route with a GET handler (ignore this if the request is handled in your `handle` hook):'
590590
);
591591

592592
for (const path of unmatched_paths) {

packages/create-svelte/bin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ await create(cwd, {
114114
vitest: options.features.includes('vitest')
115115
});
116116

117-
p.outro(`Your project is ready!`);
117+
p.outro('Your project is ready!');
118118

119119
if (options.types === 'typescript') {
120120
console.log(bold('✔ Typescript'));

packages/create-svelte/scripts/build-templates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function strip_jsdoc(content) {
3939
return '';
4040
}
4141

42-
return `/**${description.replace(/\*\ $/, '')}*/${whitespace}`;
42+
return `/**${description.replace(/\* $/, '')}*/${whitespace}`;
4343
}
4444
);
4545
}

packages/create-svelte/test/check.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ for (const pkg_path of glob(resolve_path('../../../packages/*/package.json'))) {
3232

3333
try {
3434
const kit_dir = resolve_path('../../../packages/kit');
35-
const ls_vite_result = execSync(`pnpm ls --json vite`, { cwd: kit_dir });
35+
const ls_vite_result = execSync('pnpm ls --json vite', { cwd: kit_dir });
3636
const vite_version = JSON.parse(ls_vite_result.toString())[0].devDependencies.vite.version;
3737
overrides.vite = vite_version;
3838
} catch (e) {
@@ -61,7 +61,7 @@ fs.writeFileSync(path.join(test_workspace_dir, 'pnpm-workspace.yaml'), 'packages
6161
const exec_async = promisify(exec);
6262

6363
beforeAll(async () => {
64-
await exec_async(`pnpm install --no-frozen-lockfile`, {
64+
await exec_async('pnpm install --no-frozen-lockfile', {
6565
cwd: test_workspace_dir
6666
});
6767
}, 60000);

packages/kit/src/core/config/options.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ const options = object(
210210
(/** @type {any} */ { message }) => {
211211
throw new Error(
212212
message +
213-
`\nTo suppress or handle this error, implement \`handleHttpError\` in https://kit.svelte.dev/docs/configuration#prerender`
213+
'\nTo suppress or handle this error, implement `handleHttpError` in https://kit.svelte.dev/docs/configuration#prerender'
214214
);
215215
},
216216
(input, keypath) => {
@@ -224,7 +224,7 @@ const options = object(
224224
(/** @type {any} */ { message }) => {
225225
throw new Error(
226226
message +
227-
`\nTo suppress or handle this error, implement \`handleMissingId\` in https://kit.svelte.dev/docs/configuration#prerender`
227+
'\nTo suppress or handle this error, implement `handleMissingId` in https://kit.svelte.dev/docs/configuration#prerender'
228228
);
229229
},
230230
(input, keypath) => {
@@ -238,7 +238,7 @@ const options = object(
238238
(/** @type {any} */ { message }) => {
239239
throw new Error(
240240
message +
241-
`\nTo suppress or handle this error, implement \`handleEntryGeneratorMismatch\` in https://kit.svelte.dev/docs/configuration#prerender`
241+
'\nTo suppress or handle this error, implement `handleEntryGeneratorMismatch` in https://kit.svelte.dev/docs/configuration#prerender'
242242
);
243243
},
244244
(input, keypath) => {

packages/kit/src/core/env.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export function create_dynamic_types(id, env, prefix) {
7575

7676
if (id === 'private') {
7777
properties.push(`${prefixed}: undefined;`);
78-
properties.push(`[key: string]: string | undefined;`);
78+
properties.push('[key: string]: string | undefined;');
7979
} else {
8080
properties.push(`${prefixed}: string | undefined;`);
8181
}

0 commit comments

Comments
 (0)