Skip to content

Commit 5b882c7

Browse files
committed
Add 'npm watch' task matcher, use eslint in webpack
Closes #542 Signed-off-by: David Thompson <[email protected]>
1 parent 95e6116 commit 5b882c7

File tree

5 files changed

+223
-38
lines changed

5 files changed

+223
-38
lines changed

.vscode/extensions.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{
2-
// See http://go.microsoft.com/fwlink/?LinkId=827846
3-
// for the documentation about the extensions.json format
4-
"recommendations": [
5-
"dbaeumer.vscode-eslint"
6-
]
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": ["dbaeumer.vscode-eslint", "amodio.tsl-problem-matcher"]
75
}

.vscode/tasks.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
"type": "npm",
88
"script": "watch",
99
"isBackground": true,
10+
"problemMatcher": [
11+
"$ts-webpack-watch",
12+
"$eslint-stylish"
13+
],
1014
"presentation": {
1115
"reveal": "never"
1216
},

package-lock.json

Lines changed: 167 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,6 @@
421421
"minimist": "1.2.6"
422422
},
423423
"devDependencies": {
424-
"@typescript-eslint/eslint-plugin": "^5.30.5",
425-
"@typescript-eslint/parser": "^5.30.5",
426424
"@types/chai": "^4.2.3",
427425
"@types/chai-fs": "^2.0.2",
428426
"@types/ejs": "^3.0.5",
@@ -437,9 +435,12 @@
437435
"@types/vscode": "^1.65.0",
438436
"@types/which": "^2.0.1",
439437
"@types/yauzl": "^2.9.1",
438+
"@typescript-eslint/eslint-plugin": "^5.30.5",
439+
"@typescript-eslint/parser": "^5.30.5",
440440
"chai": "^4.2.0",
441441
"chai-fs": "^2.0.0",
442442
"eslint": "^8.19.0",
443+
"eslint-webpack-plugin": "^3.2.0",
443444
"gradle-to-js": "^2.0.0",
444445
"gulp": "^4.0.2",
445446
"gulp-rename": "^1.4.0",

webpack.config.js

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,55 @@
55

66
//@ts-check
77

8-
'use strict';
8+
"use strict";
99

10-
const path = require('path');
10+
const path = require("path");
11+
const ESLintWebpackPlugin = require("eslint-webpack-plugin");
1112

1213
/**@type {import('webpack').Configuration}*/
1314
const config = {
14-
target: 'node', // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
15-
node: {
16-
__dirname: false,
17-
__filename: false
18-
},
19-
entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
20-
output: { // the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
21-
path: path.resolve(__dirname, 'dist'),
22-
filename: 'extension.js',
23-
libraryTarget: "commonjs2",
24-
devtoolModuleFilenameTemplate: "../[resource-path]",
25-
},
26-
devtool: 'source-map',
27-
externals: {
28-
vscode: "commonjs vscode" // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
29-
},
30-
resolve: { // support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
31-
extensions: ['.ts', '.js']
32-
},
33-
module: {
34-
rules: [{
35-
test: /\.ts$/,
36-
exclude: /node_modules/,
37-
use: [{
38-
loader: 'ts-loader',
39-
}]
40-
}]
41-
},
42-
}
15+
target: "node", // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
16+
node: {
17+
__dirname: false,
18+
__filename: false,
19+
},
20+
entry: "./src/extension.ts", // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
21+
output: {
22+
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
23+
path: path.resolve(__dirname, "dist"),
24+
filename: "extension.js",
25+
libraryTarget: "commonjs2",
26+
devtoolModuleFilenameTemplate: "../[resource-path]",
27+
},
28+
devtool: "source-map",
29+
externals: {
30+
vscode: "commonjs vscode", // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
31+
},
32+
resolve: {
33+
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
34+
extensions: [".ts", ".js"],
35+
},
36+
module: {
37+
rules: [
38+
{
39+
test: /\.ts$/,
40+
exclude: /node_modules/,
41+
use: [
42+
{
43+
loader: "ts-loader",
44+
},
45+
],
46+
},
47+
],
48+
},
49+
plugins: [
50+
new ESLintWebpackPlugin({
51+
extensions: [".ts", ".js"],
52+
}),
53+
],
54+
infrastructureLogging: {
55+
level: "log",
56+
},
57+
};
4358

4459
module.exports = config;

0 commit comments

Comments
 (0)