diff --git a/.eslintrc.js b/.eslintrc.js index 946a157e40..a093de610b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,65 +1,6 @@ module.exports = { root: true, - rules: { - indent: 'off', - 'no-unused-vars': 'off', - semi: [2, 'always'], - 'keyword-spacing': [2, { before: true, after: true }], - 'space-before-blocks': [2, 'always'], - 'no-mixed-spaces-and-tabs': [2, 'smart-tabs'], - 'no-cond-assign': 0, - 'object-shorthand': [2, 'always'], - 'no-const-assign': 2, - 'no-class-assign': 2, - 'no-this-before-super': 2, - 'no-var': 2, - 'no-unreachable': 2, - 'valid-typeof': 2, - 'quote-props': [2, 'as-needed'], - 'one-var': [2, 'never'], - 'prefer-arrow-callback': 2, - 'prefer-const': [2, { destructuring: 'all' }], - 'arrow-spacing': 2, - 'no-inner-declarations': 0, - 'require-atomic-updates': 'off', - '@typescript-eslint/indent': 'off', - '@typescript-eslint/camelcase': 'off', - '@typescript-eslint/no-use-before-define': 'off', - '@typescript-eslint/array-type': ['error', 'array-simple'], - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/explicit-member-accessibility': 'off', - '@typescript-eslint/no-unused-vars': [ - 'error', - { - argsIgnorePattern: '^_' - } - ], - '@typescript-eslint/no-object-literal-type-assertion': 'off', - '@typescript-eslint/no-unused-vars': 'off', - '@typescript-eslint/prefer-interface': 'off' - }, - globals: { - globalThis: false - }, - env: { - es6: true, - browser: true, - node: true, - mocha: true - }, - extends: [ - 'eslint:recommended', - 'plugin:import/errors', - 'plugin:import/warnings', - 'plugin:import/typescript', - 'plugin:@typescript-eslint/recommended' - ], - parserOptions: { - ecmaVersion: 9, - sourceType: 'module' - }, - plugins: ['svelte3'], + extends: '@sveltejs', settings: { 'import/core-modules': [ 'svelte', @@ -69,20 +10,5 @@ module.exports = { 'estree' ], 'svelte3/compiler': require('./compiler') - }, - overrides: [ - { - files: ['*.js'], - rules: { - '@typescript-eslint/no-var-requires': 'off' - } - }, - { - files: ['*.svelte'], - processor: 'svelte3/svelte3', - rules: { - '@typescript-eslint/indent': 'off' - } - } - ] + } }; diff --git a/src/compiler/compile/Component.ts b/src/compiler/compile/Component.ts index a5a31c8070..fdaad8dfa9 100644 --- a/src/compiler/compile/Component.ts +++ b/src/compiler/compile/Component.ts @@ -8,7 +8,7 @@ import { create_scopes, extract_names, Scope, - extract_identifiers, + extract_identifiers } from './utils/scope'; import Stylesheet from './css/Stylesheet'; import { test } from '../config'; @@ -155,7 +155,7 @@ export default class Component { ) || { start: 0, end: 0 }; this.warn(svelteOptions, { code: 'custom-element-no-tag', - message: `No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. . To hide this warning, use `, + message: `No custom element 'tag' option was specified. To automatically register a custom element, specify a name with a hyphen in it, e.g. . To hide this warning, use ` }); } this.tag = this.component_options.tag || compile_options.tag; @@ -190,7 +190,7 @@ export default class Component { this.add_var({ name, injected: true, - referenced: true, + referenced: true }); } else if (name[0] === '$') { this.add_var({ @@ -198,7 +198,7 @@ export default class Component { injected: true, referenced: true, mutated: true, - writable: true, + writable: true }); const subscribable_name = name.slice(1); @@ -289,7 +289,7 @@ export default class Component { } const imported_helpers = Array.from(this.helpers, ([name, alias]) => ({ name, - alias, + alias })); create_module( @@ -305,7 +305,7 @@ export default class Component { .filter(variable => variable.module && variable.export_name) .map(variable => ({ name: variable.name, - as: variable.export_name, + as: variable.export_name })) ); @@ -342,9 +342,9 @@ export default class Component { reassigned: v.reassigned || false, referenced: v.referenced || false, writable: v.writable || false, - referenced_from_script: v.referenced_from_script || false, + referenced_from_script: v.referenced_from_script || false })), - stats: this.stats.render(), + stats: this.stats.render() }; } @@ -409,7 +409,7 @@ export default class Component { source: this.source, start: pos.start, end: pos.end, - filename: this.compile_options.filename, + filename: this.compile_options.filename }); } @@ -441,7 +441,7 @@ export default class Component { pos: pos.start, filename: this.compile_options.filename, toString: () => - `${warning.message} (${start.line}:${start.column})\n${frame}`, + `${warning.message} (${start.line}:${start.column})\n${frame}` }); } @@ -453,7 +453,7 @@ export default class Component { if (node.type === 'ExportDefaultDeclaration') { this.error(node, { code: `default-export`, - message: `A component cannot have a default export`, + message: `A component cannot have a default export` }); } @@ -461,7 +461,7 @@ export default class Component { if (node.source) { this.error(node, { code: `not-implemented`, - message: `A component currently cannot have an export ... from`, + message: `A component currently cannot have an export ... from` }); } if (node.declaration) { @@ -531,10 +531,10 @@ export default class Component { if (node.type === 'LabeledStatement' && node.label.name === '$') { component.warn(node as any, { code: 'module-script-reactive-declaration', - message: '$: has no effect in a module script', + message: '$: has no effect in a module script' }); } - }, + } }); const { scope, globals } = create_scopes(script.content); @@ -544,7 +544,7 @@ export default class Component { if (name[0] === '$') { this.error(node as any, { code: 'illegal-declaration', - message: `The $ prefix is reserved, and cannot be used for variable and import names`, + message: `The $ prefix is reserved, and cannot be used for variable and import names` }); } @@ -562,7 +562,7 @@ export default class Component { if (name[0] === '$') { this.error(node as any, { code: 'illegal-subscription', - message: `Cannot reference store value inside