Chore: Remove prettier-plugin from ESLint (#45910)

* chore(eslint): remove prettier-plugin

* chore(eslint): test changes by using grafana/eslint 3.0.0-alpha

* chore(prettier): add js,ts,tsx when checking / writing

* chore(prettier): dont check js files

* chore(linting): align prettier and eslint ignore files

* style: run prettier:write on FE codebase

* chore(eslint): use grafana/eslint-config@3.0.0
This commit is contained in:
Jack Westbrook 2022-03-04 10:49:50 +01:00 committed by GitHub
parent a9b1a964b0
commit 9b5a42845d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 59 additions and 36 deletions

View File

@ -1,5 +1,5 @@
import { regexp } from '@betterer/regexp'; import { regexp } from '@betterer/regexp';
export default { export default {
'no enzyme tests': () => regexp(/from 'enzyme'/g).include('**/*.test.*') 'no enzyme tests': () => regexp(/from 'enzyme'/g).include('**/*.test.*'),
}; };

View File

@ -1,14 +1,18 @@
node_modules .git
compiled .github
.yarn
build build
vendor compiled
devenv
data data
deployment_tools_config.json
devenv
dist dist
e2e/tmp e2e/tmp
scripts/grafana-server/tmp node_modules
pkg
public/lib/monaco public/lib/monaco
deployment_tools_config.json scripts/grafana-server/tmp
vendor
# TS generate from cue by cuetsy # TS generate from cue by cuetsy
**/*.gen.ts **/*.gen.ts

View File

@ -1,14 +1,23 @@
.git .git
.github .github
dist/ .yarn
pkg/ build
node_modules compiled
public/vendor/ data
vendor/ deployment_tools_config.json
/data/ devenv
dist
e2e/tmp e2e/tmp
scripts/grafana-server/tmp node_modules
public/build/ pkg
public/sass/*.generated.scss
devenv/
public/lib/monaco public/lib/monaco
public/sass/*.generated.scss
scripts/grafana-server/tmp
vendor
# TS generate from cue by cuetsy
**/*.gen.ts
# Auto-generated localisation files
public/locales/_build/
public/locales/**/*.js

View File

@ -35,8 +35,8 @@
"packages:typecheck": "lerna run typecheck", "packages:typecheck": "lerna run typecheck",
"packages:clean": "lerna run clean", "packages:clean": "lerna run clean",
"precommit": "yarn run lint-staged", "precommit": "yarn run lint-staged",
"prettier:check": "prettier --check --list-different=false --loglevel=warn \"**/*.{scss,md,mdx}\"", "prettier:check": "prettier --check --list-different=false --loglevel=warn \"**/*.{ts,tsx,scss,md,mdx}\"",
"prettier:write": "prettier --list-different \"**/*.{scss,md,mdx}\" --write", "prettier:write": "prettier --list-different \"**/*.{js,ts,tsx,scss,md,mdx}\" --write",
"start": "yarn themes:generate && yarn dev --watch", "start": "yarn themes:generate && yarn dev --watch",
"start:noTsCheck": "yarn start --env noTsCheck=1", "start:noTsCheck": "yarn start --env noTsCheck=1",
"start:hot": "yarn themes:generate && NODE_ENV=hot yarn dev --config scripts/webpack/webpack.hot.js", "start:hot": "yarn themes:generate && NODE_ENV=hot yarn dev --config scripts/webpack/webpack.hot.js",
@ -60,7 +60,8 @@
"lint-staged": { "lint-staged": {
"*.{js,ts,tsx}": [ "*.{js,ts,tsx}": [
"betterer precommit", "betterer precommit",
"eslint --ext .js,.tsx,.ts --cache --fix" "eslint --ext .js,.tsx,.ts --cache --fix",
"prettier --write"
], ],
"*.{json,scss,md,mdx}": [ "*.{json,scss,md,mdx}": [
"prettier --write" "prettier --write"
@ -87,7 +88,7 @@
"@emotion/eslint-plugin": "11.7.0", "@emotion/eslint-plugin": "11.7.0",
"@grafana/api-documenter": "7.11.2", "@grafana/api-documenter": "7.11.2",
"@grafana/e2e": "workspace:*", "@grafana/e2e": "workspace:*",
"@grafana/eslint-config": "2.5.2", "@grafana/eslint-config": "3.0.0",
"@grafana/toolkit": "workspace:*", "@grafana/toolkit": "workspace:*",
"@grafana/tsconfig": "^1.2.0-rc1", "@grafana/tsconfig": "^1.2.0-rc1",
"@lingui/cli": "3.13.2", "@lingui/cli": "3.13.2",
@ -175,7 +176,6 @@
"eslint-plugin-jest": "^26.1.0", "eslint-plugin-jest": "^26.1.0",
"eslint-plugin-jsdoc": "37.9.1", "eslint-plugin-jsdoc": "37.9.1",
"eslint-plugin-lodash": "7.4.0", "eslint-plugin-lodash": "7.4.0",
"eslint-plugin-prettier": "4.0.0",
"eslint-plugin-react": "7.29.2", "eslint-plugin-react": "7.29.2",
"eslint-plugin-react-hooks": "4.3.0", "eslint-plugin-react-hooks": "4.3.0",
"eslint-webpack-plugin": "3.1.1", "eslint-webpack-plugin": "3.1.1",

View File

@ -6,9 +6,4 @@ import { lastPointTracker } from './lastPointTracker';
/** /**
* Registry for layer handlers * Registry for layer handlers
*/ */
export const dataLayers = [ export const dataLayers = [markersLayer, heatmapLayer, lastPointTracker, geojsonLayer];
markersLayer,
heatmapLayer,
lastPointTracker,
geojsonLayer,
];

View File

@ -78,18 +78,18 @@ export const markersLayer: MapLayerRegistryItem<MarkersConfig> = {
source, source,
}); });
if(!style.fields) { if (!style.fields) {
// Set a global style // Set a global style
vectorLayer.setStyle(style.maker(style.base)); vectorLayer.setStyle(style.maker(style.base));
} else { } else {
vectorLayer.setStyle((feature: FeatureLike) => { vectorLayer.setStyle((feature: FeatureLike) => {
const idx = feature.get("rowIndex") as number; const idx = feature.get('rowIndex') as number;
const dims = style.dims; const dims = style.dims;
if(!dims || !(isNumber(idx))) { if (!dims || !isNumber(idx)) {
return style.maker(style.base); return style.maker(style.base);
} }
const values = {...style.base}; const values = { ...style.base };
if (dims.color) { if (dims.color) {
values.color = dims.color.get(idx); values.color = dims.color.get(idx);
@ -103,7 +103,7 @@ export const markersLayer: MapLayerRegistryItem<MarkersConfig> = {
if (dims.rotation) { if (dims.rotation) {
values.rotation = dims.rotation.get(idx); values.rotation = dims.rotation.get(idx);
} }
return style.maker(values) return style.maker(values);
}); });
} }

View File

@ -4141,6 +4141,22 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@grafana/eslint-config@npm:3.0.0":
version: 3.0.0
resolution: "@grafana/eslint-config@npm:3.0.0"
dependencies:
"@typescript-eslint/eslint-plugin": 5.10.0
"@typescript-eslint/parser": 5.10.0
eslint: 7.28.0
eslint-config-prettier: 8.3.0
eslint-plugin-jsdoc: 37.7.0
eslint-plugin-react: 7.28.0
eslint-plugin-react-hooks: 4.3.0
typescript: 4.4.4
checksum: 27320a7ff7241bba132cccb62cd5d229300b0e9867d3e214ad8606c6d10a2015845bbf9d008d708f7e4f884d004c4c4c8db5694b3f2e006dcc6c5b411a3d350e
languageName: node
linkType: hard
"@grafana/experimental@npm:0.0.2-canary.18": "@grafana/experimental@npm:0.0.2-canary.18":
version: 0.0.2-canary.18 version: 0.0.2-canary.18
resolution: "@grafana/experimental@npm:0.0.2-canary.18" resolution: "@grafana/experimental@npm:0.0.2-canary.18"
@ -20701,7 +20717,7 @@ __metadata:
"@grafana/data": "workspace:*" "@grafana/data": "workspace:*"
"@grafana/e2e": "workspace:*" "@grafana/e2e": "workspace:*"
"@grafana/e2e-selectors": "workspace:*" "@grafana/e2e-selectors": "workspace:*"
"@grafana/eslint-config": 2.5.2 "@grafana/eslint-config": 3.0.0
"@grafana/experimental": 0.0.2-canary.18 "@grafana/experimental": 0.0.2-canary.18
"@grafana/google-sdk": 0.0.2 "@grafana/google-sdk": 0.0.2
"@grafana/runtime": "workspace:*" "@grafana/runtime": "workspace:*"
@ -20846,7 +20862,6 @@ __metadata:
eslint-plugin-jest: ^26.1.0 eslint-plugin-jest: ^26.1.0
eslint-plugin-jsdoc: 37.9.1 eslint-plugin-jsdoc: 37.9.1
eslint-plugin-lodash: 7.4.0 eslint-plugin-lodash: 7.4.0
eslint-plugin-prettier: 4.0.0
eslint-plugin-react: 7.29.2 eslint-plugin-react: 7.29.2
eslint-plugin-react-hooks: 4.3.0 eslint-plugin-react-hooks: 4.3.0
eslint-webpack-plugin: 3.1.1 eslint-webpack-plugin: 3.1.1