Skip to content

Commit

Permalink
style: 處理 eslint 使其可以 lint webpack.config.js 以及 eslintrc.js 自身
Browse files Browse the repository at this point in the history
  • Loading branch information
aqzhyi committed Jun 18, 2020
1 parent 36c091e commit 680a6b2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
25 changes: 6 additions & 19 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = {
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
project: 'tsconfig.json',
},
rules: {
// 提升可靠性,但沒有也沒關係。
Expand Down Expand Up @@ -50,26 +51,12 @@ module.exports = {
},
overrides: [
{
files: ['**/*.ts', '**/*.tsx'],
parserOptions: {
project: 'tsconfig.json',
files: ['**/webpack.config.js'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
},
},
{
files: ['**/webpack.config.ts'],
parserOptions: {
project: 'tsconfig.webpack.json',
},
},
{
files: ['**/*.test.js'],
env: {
jest: true,
},
},
{
files: ['src/**/*.js'],
parser: 'babel-eslint',
},
],
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
}
},
"exclude": ["**/__tests__", "**/*.{spec,test}.tsx"],
"include": ["src"]
"include": ["src", "./*.js", "./.*.js"]
}
5 changes: 3 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
const { BannerPlugin } = require('webpack')
const ProgressBarPlugin = require('progress-bar-webpack-plugin')
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin')
const packageJSON = require('./package.json')

const srcSubAlias = globby
.sync(['src/*'], {
Expand Down Expand Up @@ -125,7 +126,7 @@ const configration = {
// ==UserScript==
// @name Better etoro UI for Taiwan
// @description 提供你更好的 etoro 新台幣介面增強懶人包
// @version 0.13.0
// @version ${packageJSON.version}
// @author hilezir
// @grant GM_xmlhttpRequest
// @grant GM_addStyle
Expand All @@ -151,7 +152,7 @@ const configration = {
window.GM_xmlhttpRequest({
// url: 'http://127.0.0.1:8080/etoro.bundle.js', // 開發模式
url: 'https://cdn.jsdelivr.net/gh/hilezir/etoro-better-ui@v0.13.0/src_dist/etoro.bundle.js',
url: 'https://cdn.jsdelivr.net/gh/hilezir/etoro-better-ui@v${packageJSON.version}/src_dist/etoro.bundle.js',
onload: event => {
eval(event.responseText)
},
Expand Down

0 comments on commit 680a6b2

Please sign in to comment.