Migrate from TSLint to ESLint

TSLint deprecated and is being replaced by ESLint.

Add Vue CLI plugin (@vue/cli-plugin-eslint) using:
`vue add @vue/cli-plugin-eslint`. It also adds `.eslintrc.js` manually
for Cypress since Vue CLI for ESLint misses it (vuejs/vue-cli#6892).

Also rename `npm run lint:vue` to `npm run lint:eslint` for better
clarification.

This commit disables all rules that the current code is not compliant
with. This allows for enabling them gradually and separating commits
instead of mixing ESLint introduction with other code changes.

AirBnb is chosen as base configuration.

"Standard" is not chosen due to its poor defaults. It makes code cleaner
but harder to maintain:
  - It converts interfaces to types which is harder to read.
  - Removes semicolons that helps to eliminate some ambigious code.

"Airbnb" on the other hand helps for easier future changes and
maintinability:
  - Includes more useful rules.
  - Keeps the semicolons and interfaces.
  - Enforces trailing commas that makes it easier to delete lines later on.
  - Delete branches: standard, prettier.
This commit is contained in:
undergroundwires
2021-12-27 22:42:27 +01:00
parent 455084c17b
commit 61b475fa8d
20 changed files with 7333 additions and 3204 deletions

View File

@@ -97,7 +97,6 @@ describe('ApplicationCode', () => {
};
},
};
// tslint:disable-next-line:no-unused-expression
new ApplicationCode(selection, expectedDefinition, generatorMock);
// act
const act = () => selection.changed.notify([]);
@@ -122,7 +121,6 @@ describe('ApplicationCode', () => {
};
},
};
// tslint:disable-next-line:no-unused-expression
new ApplicationCode(selection, expectedDefinition, generatorMock);
// act
const act = () => selection.changed.notify(scriptsToSelect);

View File

@@ -20,7 +20,7 @@ describe('SelectedScript', () => {
const script = new ScriptStub(expectedId)
.withRevertCode(undefined);
// act
function construct() { new SelectedScript(script, true); } // tslint:disable-line:no-unused-expression
function construct() { new SelectedScript(script, true); }
// assert
expect(construct).to.throw('cannot revert an irreversible script');
});

View File

@@ -1,7 +1,6 @@
import 'mocha';
import { expect } from 'chai';
import { ExpressionPosition } from '@/application/Parser/Script/Compiler/Expressions/Expression/ExpressionPosition';
// tslint:disable-next-line:max-line-length
import { ExpressionEvaluator, Expression } from '@/application/Parser/Script/Compiler/Expressions/Expression/Expression';
import { IReadOnlyFunctionCallArgumentCollection } from '@/application/Parser/Script/Compiler/Function/Call/Argument/IFunctionCallArgumentCollection';
import { FunctionCallArgumentCollectionStub } from '@tests/unit/stubs/FunctionCallArgumentCollectionStub';

View File

@@ -126,7 +126,6 @@ describe('SharedFunctionsParser', () => {
const invalidParameterName = 'invalid function p@r4meter name';
const functionName = 'functionName';
let parameterException: Error;
// tslint:disable-next-line:no-unused-expression
try { new FunctionParameter(invalidParameterName, false); } catch (e) { parameterException = e; }
const expectedError = `"${functionName}": ${parameterException.message}`;
const functionData = FunctionDataStub.createWithCode()

View File

@@ -1,11 +1,9 @@
import 'mocha';
import { expect } from 'chai';
import { INode, NodeType } from '@/presentation/components/Scripts/View/ScriptsTree/SelectableTree/Node/INode';
// tslint:disable-next-line:max-line-length
import { getReverter } from '@/presentation/components/Scripts/View/ScriptsTree/SelectableTree/Node/Reverter/ReverterFactory';
import { ScriptReverter } from '@/presentation/components/Scripts/View/ScriptsTree/SelectableTree/Node/Reverter/ScriptReverter';
import { CategoryReverter } from '@/presentation/components/Scripts/View/ScriptsTree/SelectableTree/Node/Reverter/CategoryReverter';
// tslint:disable-next-line:max-line-length
import { getScriptNodeId, getCategoryNodeId } from '@/presentation/components/Scripts/View/ScriptsTree/ScriptNodeParser';
import { CategoryCollectionStub } from '@tests/unit/stubs/CategoryCollectionStub';
import { CategoryStub } from '@tests/unit/stubs/CategoryStub';

View File

@@ -1,4 +1,3 @@
// tslint:disable-next-line:max-line-length
import { IFunctionCallArgument } from '@/application/Parser/Script/Compiler/Function/Call/Argument/IFunctionCallArgument';
import { IFunctionCallArgumentCollection } from '@/application/Parser/Script/Compiler/Function/Call/Argument/IFunctionCallArgumentCollection';
import { FunctionCallArgumentStub } from './FunctionCallArgumentStub';

View File

@@ -1,4 +1,3 @@
// tslint:disable-next-line:max-line-length
import { IFunctionCallArgument } from '@/application/Parser/Script/Compiler/Function/Call/Argument/IFunctionCallArgument';
export class FunctionCallArgumentStub implements IFunctionCallArgument {