-
-
Notifications
You must be signed in to change notification settings - Fork 237
/
eslint-basic.fixture
95 lines (91 loc) · 2.09 KB
/
eslint-basic.fixture
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/// package.json
{
"name": "eslint-basic-fixture",
"version": "1.0.0",
"main": "dist/index.js",
"license": "MIT",
"scripts": {
"webpack-dev-server": "webpack-dev-server"
},
"devDependencies": {
"@types/eslint": "^6.8.0",
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"css-loader": "^3.5.0",
"eslint": "^6.8.0",
"fork-ts-checker-webpack-plugin": ${FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION},
"style-loader": "^1.2.0",
"ts-loader": ${TS_LOADER_VERSION},
"typescript": ${TYPESCRIPT_VERSION},
"webpack": ${WEBPACK_VERSION},
"webpack-cli": ${WEBPACK_CLI_VERSION},
"webpack-dev-server": ${WEBPACK_DEV_SERVER_VERSION}
}
}
/// tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"lib": ["ES6", "DOM"],
"moduleResolution": "node",
"esModuleInterop": true,
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"strict": true,
"baseUrl": "./src",
"outDir": "./dist"
},
"include": ["./src"],
"exclude": ["node_modules"]
}
/// .eslintrc.js
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module'
},
extends: ['plugin:@typescript-eslint/recommended']
};
/// webpack.config.js
const path = require('path');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
module.exports = {
entry: './src/index.ts',
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist'),
},
module: {
rules: [
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.tsx?$/,
loader: 'ts-loader',
exclude: /node_modules/,
options: {
transpileOnly: true
}
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
plugins: [
new ForkTsCheckerWebpackPlugin({
async: ${ASYNC},
eslint: {
enabled: true,
files: './src/**/*.{ts,tsx,js,jsx}'
},
logger: {
infrastructure: "console"
}
})
]
};