TSLint → ESLint (#21006)

* Alphabetized tslint and tsconfig files

* Optimized tsconfig files

* Optimized editorconfig & prettier config files

… to reduce redundancy

* Switched to @grafana/tsconfig

… and:
* de-duped options
* removed options with default values

* Fixed nasty issue with types for nested slate-react

* Replaced TSLint with ESLint

* TSLint disables → ESLint disables

… also JSHint removals, which haven’t had an affect since it was replaced with TSLint.

* Compliances for ESLint, Prettier and TypeScript

* Updated lockfile
This commit is contained in:
Steven Vachon
2020-02-07 20:40:04 -05:00
committed by GitHub
parent 7dcf5887e6
commit f48169633c
86 changed files with 909 additions and 746 deletions

View File

@@ -0,0 +1,6 @@
{
"extends": ["@grafana/eslint-config"],
"rules": {
"no-restricted-imports": [2, "^@grafana/data.*", "^@grafana/runtime.*", "^@grafana/ui.*"]
}
}

View File

@@ -14,13 +14,15 @@
"main": "src/index.ts",
"types": "src/index.ts",
"scripts": {
"tslint": "tslint -c tslint.json --project tsconfig.json",
"lint": "eslint src/ --ext=.js,.ts,.tsx",
"typecheck": "tsc --noEmit",
"clean": "rimraf ./dist ./compiled",
"bundle": "rollup -c rollup.config.ts",
"build": "grafana-toolkit package:build --scope=data"
},
"devDependencies": {
"@grafana/eslint-config": "^1.0.0-rc1",
"@grafana/tsconfig": "^1.0.0-rc1",
"@types/jest": "23.3.14",
"@types/jquery": "1.10.35",
"@types/lodash": "4.14.123",

View File

@@ -6,7 +6,7 @@ import { toDataFrameDTO, toDataFrame } from './processDataFrame';
import { FieldType } from '../types';
import { Table } from 'apache-arrow';
/* tslint:disable */
/* eslint-disable */
const resp = {
results: {
'': {
@@ -21,7 +21,7 @@ const resp = {
},
},
};
/* tslint:enable */
/* eslint-enable */
describe('GEL Utils', () => {
test('should parse output with dataframe', () => {

View File

@@ -1,5 +1,5 @@
import { TimeZone } from '../types/time';
/* tslint:disable:import-blacklist ban ban-types */
/* eslint-disable id-blacklist, no-restricted-imports, @typescript-eslint/ban-types */
import moment, { Moment, MomentInput, DurationInputArg1 } from 'moment';
export interface DateTimeBuiltinFormat {
__momentBuiltinFormatBrand: any;

View File

@@ -14,7 +14,7 @@ interface AppendedVectorInfo<T> {
*/
export class AppendedVectors<T = any> implements Vector<T> {
length = 0;
source: Array<AppendedVectorInfo<T>> = new Array<AppendedVectorInfo<T>>();
source: Array<AppendedVectorInfo<T>> = [];
constructor(startAt = 0) {
this.length = startAt;
@@ -29,7 +29,7 @@ export class AppendedVectors<T = any> implements Vector<T> {
this.length = length;
} else if (length < this.length) {
// make the array shorter
const sources: Array<AppendedVectorInfo<T>> = new Array<AppendedVectorInfo<T>>();
const sources: Array<AppendedVectorInfo<T>> = [];
for (const src of this.source) {
sources.push(src);
if (src.end > length) {

View File

@@ -1,4 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["dist", "node_modules", "**/*.test.ts", "**/*.test.tsx"]
"exclude": ["dist", "node_modules", "**/*.test.ts*"],
"extends": "./tsconfig.json"
}

View File

@@ -1,11 +1,11 @@
{
"extends": "../tsconfig.json",
"include": ["src/**/*.ts", "src/**/*.tsx", "../../public/app/types/jquery/*.ts"],
"exclude": ["dist", "node_modules"],
"compilerOptions": {
"rootDirs": ["."],
"typeRoots": ["./node_modules/@types", "types"],
"declarationDir": "dist",
"outDir": "compiled"
}
"outDir": "compiled",
"rootDirs": ["."],
"typeRoots": ["node_modules/@types"]
},
"exclude": ["dist", "node_modules"],
"extends": "@grafana/tsconfig",
"include": ["src/**/*.ts*", "../../public/app/types/jquery/*.ts"]
}

View File

@@ -1,6 +0,0 @@
{
"extends": "../../tslint.json",
"rules": {
"import-blacklist": [true, ["^@grafana/data.*"], ["^@grafana/ui.*"], ["^@grafana/runtime.*"]]
}
}