From 34e4f182bcec1a31887724ae493d7b91b38f4491 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Tue, 11 Feb 2020 13:27:26 +0100 Subject: [PATCH] Toolkit: add a warning about tslint migration (#22089) --- packages/grafana-toolkit/package.json | 2 ++ .../grafana-toolkit/src/cli/tasks/plugin.build.ts | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/packages/grafana-toolkit/package.json b/packages/grafana-toolkit/package.json index 1e4f5095cd7..53923427f54 100644 --- a/packages/grafana-toolkit/package.json +++ b/packages/grafana-toolkit/package.json @@ -46,6 +46,8 @@ "@types/semver": "^6.0.0", "@types/tmp": "^0.1.0", "@types/webpack": "4.4.34", + "@typescript-eslint/eslint-plugin": "2.19.2", + "@typescript-eslint/parser": "2.19.2", "axios": "0.19.0", "babel-jest": "24.8.0", "babel-loader": "8.0.6", diff --git a/packages/grafana-toolkit/src/cli/tasks/plugin.build.ts b/packages/grafana-toolkit/src/cli/tasks/plugin.build.ts index 929980296dd..3880d96909a 100644 --- a/packages/grafana-toolkit/src/cli/tasks/plugin.build.ts +++ b/packages/grafana-toolkit/src/cli/tasks/plugin.build.ts @@ -63,6 +63,17 @@ const getTypescriptSources = () => globby(resolvePath(process.cwd(), 'src/**/*.+ const getStylesSources = () => globby(resolvePath(process.cwd(), 'src/**/*.+(scss|css)')); export const lintPlugin = useSpinner('Linting', async ({ fix }) => { + try { + // Show a warning if the tslint file exists + await fs.access(resolvePath(process.cwd(), 'tslint.json')); + console.log('--------------------------------------------------------------'); + console.log('NOTE: @grafana/toolkit has migrated to use eslint'); + console.log('Update your configs to use .eslintrc rather than tslint.json'); + console.log('--------------------------------------------------------------'); + } catch { + // OK: tslint does not exist + } + // @todo should remove this because the config file could be in a parent dir or within package.json const configFile = await globby(resolvePath(process.cwd(), '.eslintrc?(.cjs|.js|.json|.yaml|.yml)')).then( filePaths => {