Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Upgrade svelte eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Sep 22, 2020
1 parent 93c77a3 commit 7eac08e
Show file tree
Hide file tree
Showing 17 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^8.0.1",
"@rollup/plugin-replace": "^2.3.3",
"@sveltejs/eslint-config": "github:sveltejs/eslint-config#v5.0.0",
"@sveltejs/eslint-config": "github:sveltejs/eslint-config#v5.1.0",
"@types/cookie": "^0.4.0",
"@types/mocha": "^8.0.0",
"@types/node": "^10.0.0",
Expand Down Expand Up @@ -81,7 +81,7 @@
"pretest": "npm run check",
"build": "rm -rf dist && rollup -c",
"check": "rm -rf dist && cross-env TS_CHECK_ENABLED=true rollup -c",
"lint": "eslint \"{src,runtime}/**/*.{ts,js}\"",
"lint": "npx eslint '{src,runtime}/**/*[!.d].{ts,js}'",
"prepare": "npm run build",
"dev": "rollup -cw",
"prepublishOnly": "npm test"
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export async function hydrate_target(dest: Target): Promise<HydratedTarget> {
fetch: (url: string, opts?: any) => fetch(url, opts),
redirect: (statusCode: number, location: string) => {
if (redirect && (redirect.statusCode !== statusCode || redirect.location !== location)) {
throw new Error(`Conflicting redirects`);
throw new Error('Conflicting redirects');
}
redirect = { statusCode, location };
},
Expand Down
6 changes: 3 additions & 3 deletions runtime/src/server/middleware/get_page_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export function get_page_handler(
const preload_context = {
redirect: (statusCode: number, location: string) => {
if (redirect && (redirect.statusCode !== statusCode || redirect.location !== location)) {
throw new Error(`Conflicting redirects`);
throw new Error('Conflicting redirects');
}
location = location.replace(/^\//g, ''); // leading slash (only)
redirect = { statusCode, location };
Expand Down Expand Up @@ -239,7 +239,7 @@ export function get_page_handler(
error: error
? error instanceof Error
? error
: { message: error, name: "PreloadError" }
: { message: error, name: 'PreloadError' }
: null
};

Expand Down Expand Up @@ -410,7 +410,7 @@ function serialize_error(error: Error | { message: string }) {
function escape_html(html: string) {
const chars: Record<string, string> = {
'"' : 'quot',
"'": '#39',
'\'': '#39',
'&': 'amp',
'<' : 'lt',
'>' : 'gt'
Expand Down
2 changes: 1 addition & 1 deletion src/api/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export async function build({
static_files = path.resolve(cwd, static_files);

if (legacy && bundler === 'webpack') {
throw new Error(`Legacy builds are not supported for projects using webpack`);
throw new Error('Legacy builds are not supported for projects using webpack');
}

rimraf(output);
Expand Down
2 changes: 1 addition & 1 deletion src/api/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class Watcher extends EventEmitter {

const emitFatal = () => {
this.emit('fatal', {
message: `Server crashed`
message: 'Server crashed'
} as FatalEvent);

this.crashed = true;
Expand Down
2 changes: 1 addition & 1 deletion src/api/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ async function _export({
if (typeof body === 'string') {
body = minify_html(body);
} else {
oninfo({ message: `Content of {url} has content-type text/html but the content was received as a binary buffer. The HTML will not be minified.` });
oninfo({ message: `Content of ${url} has content-type text/html but the content was received as a binary buffer. The HTML will not be minified.` });
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/api/utils/export_queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type QueueOpts = {
// determines current state of a promise
function promiseState(p: Promise<any>) {
const t = {};
return Promise.race([p, t]).then(v => (v === t) ? "pending" : "fulfilled", () => "rejected");
return Promise.race([p, t]).then(v => (v === t) ? 'pending' : 'fulfilled', () => 'rejected');
}

// finds first non-pending promise in a list of promises
Expand Down
2 changes: 1 addition & 1 deletion src/api/utils/validate_bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function validate_bundler(bundler?: 'rollup' | 'webpack') {
deprecate_dir('rollup');
deprecate_dir('webpack');

throw new Error(`Could not find a configuration file for rollup or webpack`);
throw new Error('Could not find a configuration file for rollup or webpack');
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const prog = sade('sapper').version(pkg.version);

if (process.argv[2] === 'start') {
// remove this in a future version
console.error(colors.bold().red(`'sapper start' has been removed`));
console.error(`Use 'node [build_dir]' instead`);
console.error(colors.bold().red('"sapper start" has been removed'));
console.error('Use "node [build_dir]" instead');
process.exit(1);
}

Expand Down Expand Up @@ -155,7 +155,7 @@ prog.command('build [dest]')
.option('--routes', 'Routes directory', 'src/routes')
.option('--output', 'Sapper intermediate file output directory', 'src/node_modules/@sapper')
.option('--ext', 'Custom page route extensions (space separated)', '.svelte .html')
.example(`build custom-dir -p 4567`)
.example('build custom-dir -p 4567')
.action(async (dest = '__sapper__/build', opts: {
port: string;
legacy: boolean;
Expand All @@ -166,7 +166,7 @@ prog.command('build [dest]')
output: string;
ext: string;
}) => {
console.log(`> Building...`);
console.log('> Building...');

try {
await _build(opts.bundler, opts.legacy, opts.cwd, opts.src, opts.routes, opts.output, dest, opts.ext);
Expand Down Expand Up @@ -226,7 +226,7 @@ prog.command('export [dest]')
}) => {
try {
if (opts.build) {
console.log(`> Building...`);
console.log('> Building...');
await _build(opts.bundler, opts.legacy, opts.cwd, opts.src, opts.routes, opts.output, opts['build-dir'], opts.ext);
console.error(`\n> Built in ${elapsed(start)}`);
}
Expand Down
2 changes: 1 addition & 1 deletion src/config/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {

output: (): OutputOptions => {
let dir = `${dest}/client`;
if (process.env.SAPPER_LEGACY_BUILD) dir += `/legacy`;
if (process.env.SAPPER_LEGACY_BUILD) dir += '/legacy';

return {
dir,
Expand Down
4 changes: 2 additions & 2 deletions src/config/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default {
path: `${dest}/client`,
filename: '[hash]/[name].js',
chunkFilename: '[hash]/[name].[id].js',
publicPath: `client/`
publicPath: 'client/'
};
}
},
Expand All @@ -32,7 +32,7 @@ export default {
path: `${dest}/server`,
filename: '[name].js',
chunkFilename: '[hash]/[name].[id].js',
publicPath: `client/`,
publicPath: 'client/',
libraryTarget: 'commonjs2'
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/create_app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function create_serviceworker_manifest({ manifest_data, output, client_fi
} else {
// TODO remove in a future version
if (fs.existsSync('assets')) {
throw new Error(`As of Sapper 0.21, the assets/ directory should become static/`);
throw new Error('As of Sapper 0.21, the assets/ directory should become static/');
}
}

Expand Down Expand Up @@ -197,7 +197,7 @@ function generate_server_manifest(
handlers: route_${i},
params: ${route.params.length > 0
? `match => ({ ${route.params.map(create_param_match).join(', ')} })`
: `() => ({})`}
: '() => ({})'}
}`).join(',\n\n\t\t\t\t')}
],
Expand Down
2 changes: 1 addition & 1 deletion src/core/create_compilers/RollupCompiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function(files) {

const get_entry_point_output_chunk = (bundle: OutputBundle, entry_point?: string) => {
if (entry_point === undefined) {
throw new Error("Internal error: entry_point cannot be undefined");
throw new Error('Internal error: entry_point cannot be undefined');
}

let entry_point_output_chunk: OutputChunk;
Expand Down
2 changes: 1 addition & 1 deletion src/core/create_compilers/WebpackCompiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class WebpackCompiler {

if (result.errors.length) {
console.error(stats.toString({ colors: true }));
reject(new Error(`Encountered errors while building app`));
reject(new Error('Encountered errors while building app'));
}

else {
Expand Down
2 changes: 1 addition & 1 deletion src/core/create_manifest_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function create_manifest_data(cwd: string, extensions: string = '

// TODO remove in a future version
if (!fs.existsSync(cwd)) {
throw new Error(`As of Sapper 0.21, the routes/ directory should become src/routes/`);
throw new Error('As of Sapper 0.21, the routes/ directory should become src/routes/');
}

function find_layout(file_name: string, component_name: string, dir: string = '') {
Expand Down
2 changes: 1 addition & 1 deletion src/core/read_template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default function read_template(dir: string) {
try {
return fs.readFileSync(`${dir}/template.html`, 'utf-8');
} catch (err) {
if (fs.existsSync(`app/template.html`)) {
if (fs.existsSync('app/template.html')) {
throw new Error(`As of Sapper 0.21, the default folder structure has been changed:
app/ --> src/
routes/ --> src/routes/
Expand Down

0 comments on commit 7eac08e

Please sign in to comment.