Skip to content

Commit

Permalink
chore: prefer const (#721)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann authored Aug 24, 2023
1 parent f4d5113 commit d887962
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 20 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ module.exports = {
'n/no-unpublished-import': 'off',
'n/no-unpublished-require': 'off',
'no-process-exit': 'off',
'prefer-const': ['error', { destructuring: 'all' }],
quotes: ['error', 'single', { avoidEscape: true }],
'unicorn/prefer-node-protocol': 'error'
},
Expand Down
4 changes: 2 additions & 2 deletions packages/e2e-tests/e2e-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ export async function serve(root, isBuild, port) {
if (isBuild) {
let buildResult;
let hasErr = false;
let out = [];
let err = [];
const out = [];
const err = [];

try {
const buildProcess = execa('pnpm', ['build'], {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script context="module">
export let y = 1;
export const y = 1;
</script>

<script>
export let id;
let x = 0;
const x = 0;
</script>

<pre {id}>
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/prebundle-svelte-deps/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { setSomeContext } from 'e2e-test-dep-svelte-api-only';
import { getContext } from 'svelte';
setSomeContext();
let apiOnlyLoaded = !!getContext('svelte-api-only');
const apiOnlyLoaded = !!getContext('svelte-api-only');
</script>

<main>
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/preprocess-with-vite/src/Foo.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
let foo: string = 'stylus';
const foo: string = 'stylus';
export let bla: string = 'blub';
console.log('pure test 1', new Date());
console.log('pure test 2');
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/ts-type-import/src/App.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { foobar } from './foobar.js';
let s: string = 'world';
const s: string = 'world';
</script>

<div id="hello">Hello {s}</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/vite-ssr-esm/src/components/Foo.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
let bar = 'bar';
const bar = 'bar';
</script>

<div class="blue">Foo bar={bar}</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/vite-ssr/src/components/Foo.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
let bar = 'bar';
const bar = 'bar';
</script>

<div class="blue">Foo bar={bar}</div>
Expand Down
10 changes: 1 addition & 9 deletions packages/playground/optimizedeps-include/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
const SVELTE_IMPORTS = [
'svelte/animate',
'svelte/easing',
'svelte/internal',
'svelte/motion',
'svelte/store',
'svelte/transition',
'svelte'
];

export default defineConfig(({ command, mode }) => {
const isProduction = mode === 'production';
return {
Expand Down
4 changes: 2 additions & 2 deletions packages/vite-plugin-svelte/src/types/compile.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface Compiled {
css: Code;
ast: any; // TODO type
warnings: any[]; // TODO type
vars: {
vars: Array<{
name: string;
export_name: string;
injected: boolean;
Expand All @@ -29,7 +29,7 @@ export interface Compiled {
referenced: boolean;
writable: boolean;
referenced_from_script: boolean;
}[];
}>;
stats: {
timings: {
total: number;
Expand Down

0 comments on commit d887962

Please sign in to comment.