Skip to content

Commit

Permalink
GH-708 Improve eslint config (#27)
Browse files Browse the repository at this point in the history
- Refactor eslint config according to the recommendations of https://typescript-eslint.io/docs/linting/monorepo/
- Add CLI script for fixing eslint issues

Part of eclipse-glsp/glsp#708
  • Loading branch information
tortmayr authored Jul 27, 2022
1 parent e56e93f commit d4fccf3
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 35 deletions.
7 changes: 5 additions & 2 deletions ...s/vscode-integration-webview/.eslintrc.js → .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
extends: '@eclipse-glsp',
ignorePatterns: ['**/{node_modules,lib}', '**/.eslintrc.js'],

parserOptions: {
tsconfigRootDir: __dirname,
project: 'tsconfig.json'
project: 'tsconfig.eslint.json'
},
rules: {
'no-restricted-imports': [
Expand All @@ -15,7 +18,7 @@ module.exports = {
{
name: 'sprotty-protocol',
message:
"The sprotty-protocol default exports are customized and reexported by GLSP. Please use '@eclipse-glsp/client' instead"
"The sprotty-protocol default exports are customized and reexported by GLSP. Please use '@eclipse-glsp/protocol' or '@eclipse-glsp/client' instead"
}
]
}
Expand Down
6 changes: 1 addition & 5 deletions example/workflow/extension/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
extends: '@eclipse-glsp',
parserOptions: {
tsconfigRootDir: __dirname,
project: 'tsconfig.json'
},
extends: '../../../.eslintrc.js',
rules: {
'import/no-unresolved': 'off'
}
Expand Down
3 changes: 2 additions & 1 deletion example/workflow/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@
"prepare": "yarn clean && yarn build && yarn lint",
"clean": "rimraf lib tsconfig.tsbuildinfo",
"watch": "tsc -w",
"lint": "eslint -c ./.eslintrc.js --ext .ts ./src",
"lint": "eslint --ext .ts,.tsx ./src",
"lint:fix": "eslint --fix --ext .ts,.tsx ./src",
"build": "tsc && yarn download:Server",
"publish": "vsce publish",
"download:Server": "ts-node ../scripts/download.ts"
Expand Down
8 changes: 0 additions & 8 deletions example/workflow/webview/.eslintrc.js

This file was deleted.

3 changes: 2 additions & 1 deletion example/workflow/webview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"prepare": "yarn clean && yarn build && yarn lint",
"clean": "rimraf lib ../extension/pack tsconfig.tsbuildinfo",
"build": "tsc && webpack --mode=development",
"lint": "eslint -c ./.eslintrc.js --ext .ts ./src",
"lint": "eslint --ext .ts,.tsx ./src",
"lint:fix": "eslint --fix --ext .ts,.tsx ./src",
"watch": "tsc -w"
}
}
3 changes: 2 additions & 1 deletion packages/vscode-integration-webview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"clean": "rimraf lib tsconfig.tsbuildinfo",
"build": "tsc",
"watch": "tsc -w",
"lint": "eslint -c ./.eslintrc.js --ext .ts ./src"
"lint": "eslint --ext .ts,.tsx ./src",
"lint:fix": "eslint --fix --ext .ts,.tsx ./src"
},
"publishConfig": {
"access": "public"
Expand Down
6 changes: 1 addition & 5 deletions packages/vscode-integration/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
extends: '@eclipse-glsp',
parserOptions: {
tsconfigRootDir: __dirname,
project: 'tsconfig.json'
},
extends: '../../.eslintrc.js',
rules: {
'import/no-unresolved': 'off'
}
Expand Down
3 changes: 2 additions & 1 deletion packages/vscode-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"clean": "rimraf lib tsconfig.tsbuildinfo",
"build": "tsc",
"watch": "tsc -w",
"lint": "eslint -c ./.eslintrc.js --ext .ts ./src"
"lint": "eslint --ext .ts,.tsx ./src",
"lint:fix": "eslint --fix --ext .ts,.tsx ./src"
},
"publishConfig": {
"access": "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
import { CenterAction, FitToScreenAction, LayoutOperation, RequestExportSvgAction } from '@eclipse-glsp/protocol';
import { SelectAllAction } from 'sprotty-protocol';
import { CenterAction, FitToScreenAction, LayoutOperation, RequestExportSvgAction, SelectAllAction } from '@eclipse-glsp/protocol';
import * as vscode from 'vscode';
import { GlspVscodeConnector } from '../glsp-vscode-connector';

Expand Down
8 changes: 8 additions & 0 deletions tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@eclipse-glsp/ts-config/tsconfig.json",
"compilerOptions": {
"noEmit": true
},
"exclude": ["**/node_modules", "**/.eslintrc.js"],
"include": ["packages/*/src", "example/**/*/src", "**/scripts/"]
}
9 changes: 0 additions & 9 deletions tsconfig.json

This file was deleted.

0 comments on commit d4fccf3

Please sign in to comment.