Skip to content

Commit 3cd0abc

Browse files
authored
feat: update scaffold (#6)
* chore: update prettierc * chore: add rimraf * chore: remove useless fields * chore: remove lerna clean script * feat: build umd, umd:min * feat: add sourcemap * feat: add devServer open * feat: use yarn workspaces run command * feat: omit rootPath in path.resolve * feat: update babel-loader cacheDirectory * feat: remove webpack.definePlugin * feat: remove $schema for package.json and tsconfig.json * feat: remove ENV.LIBRARY_NAME * feat: use run-p exec build:* * feat: add fork-ts-checker-plugin in dev mode * feat: remove optimize-css-assets-webpack-plugin * feat: add postcss-preset-env * feat: add typed-css-modules-webpack-plugin * feat: use @mjolnir/prettier-config * feat: adjust config files * feat: adjust eslint ignore file
1 parent 03f3ef7 commit 3cd0abc

21 files changed

+1375
-722
lines changed

.eslintignore

+7
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1+
# by default, dotfile will ignored by eslint
2+
# we unignore them to be linted
3+
!/.*
4+
5+
# build assets should not lint
16
dist/
7+
8+
# generated style d.ts
29
**/*.less.d.ts

.eslintrc.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const { recommended } = require('@mjolnir/eslint-config/overrides');
2+
3+
module.exports = {
4+
extends: ['@mjolnir'],
5+
overrides: recommended,
6+
rules: {
7+
'node/no-unpublished-import': 'off',
8+
},
9+
};

.eslintrc.json

-12
This file was deleted.

.lintstagedrc

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
{
22
"$schema": "http://json.schemastore.org/lintstagedrc.schema",
3-
"**/*.{js, ts, jsx, tsx}": ["eslint --fix", "git add"],
4-
"**/*.{less, css}": ["prettier --write", "git add"],
5-
"**/*.{json, html, md}": ["prettier --write", "git add"]
3+
"*.{js,jsx,ts,tsx}": [
4+
"eslint --fix",
5+
"git add"
6+
],
7+
"*.{less,css}": [
8+
"prettier --write",
9+
"git add"
10+
],
11+
".*rc": [
12+
"prettier --write",
13+
"git add"
14+
],
15+
"*.{html,json,md,mdx,yaml,yml}": [
16+
"prettier --write",
17+
"git add"
18+
]
619
}

.postcssrc.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"plugins": {
3+
"postcss-preset-env": {}
4+
}
5+
}

.prettierrc.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
'use strict';
2-
31
module.exports = {
4-
...require("@mjolnir/prettier-config")
2+
...require('@mjolnir/prettier-config'),
53
// override edge case
6-
}
4+
};

babel.config.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
'use strict';
2-
3-
module.exports = (api) => {
1+
module.exports = api => {
42
api.cache(false);
53

64
return {
@@ -10,9 +8,9 @@ module.exports = (api) => {
108
'@mjolnir/babel-preset',
119
{
1210
react: true,
13-
typescript: true
14-
}
15-
]
16-
]
11+
typescript: true,
12+
},
13+
],
14+
],
1715
};
1816
};

config/env.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict';
21
const path = require('path');
32

43
const rootPath = process.cwd();

config/webpack/lib/webpack.config.base.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
42

53
const env = require('../../env');

config/webpack/lib/webpack.config.development.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict';
21
const path = require('path');
32
const merge = require('webpack-merge');
43

config/webpack/lib/webpack.config.production.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict';
21
const path = require('path');
32
const merge = require('webpack-merge');
43
const TerserPlugin = require('terser-webpack-plugin');

config/webpack/react/webpack.config.base.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict';
21
const path = require('path');
32
const webpack = require('webpack');
43
const WebpackBar = require('webpackbar');

config/webpack/react/webpack.config.dev.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict';
21
const webpack = require('webpack');
32
const merge = require('webpack-merge');
43
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');

config/webpack/react/webpack.config.prod.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict';
21
const merge = require('webpack-merge');
32
const webpack = require('webpack');
43
const TerserPlugin = require('terser-webpack-plugin');

jest.config.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
'use strict';
2-
31
module.exports = {
42
preset: 'ts-jest',
5-
collectCoverage: true
3+
collectCoverage: true,
64
};

package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"clean": "yarn workspaces run clean",
99
"changelog": "lerna-changelog",
1010
"build": "yarn workspaces run build",
11-
"lint": "yarn workspaces run lint",
11+
"lint": "eslint --ext .js,.jsx,.ts,.tsx ./",
1212
"test": "jest",
1313
"release": "npm run test && npm run build && lerna publish"
1414
},
@@ -17,7 +17,7 @@
1717
"@commitlint/cli": "^8.1.0",
1818
"@commitlint/config-conventional": "^8.1.0",
1919
"@mjolnir/babel-preset": "^0.0.2",
20-
"@mjolnir/eslint-config": "^0.1.1",
20+
"@mjolnir/eslint-config": "^0.4.0",
2121
"@mjolnir/prettier-config": "^0.1.0",
2222
"@mjolnir/tsconfig": "^0.0.3",
2323
"@types/jest": "^24.0.17",
@@ -28,9 +28,7 @@
2828
"cross-env": "^5.2.0",
2929
"css-loader": "^3.2.0",
3030
"eslint": "^6.1.0",
31-
"eslint-config-prettier": "^6.0.0",
3231
"eslint-loader": "^3.0.0",
33-
"eslint-plugin-prettier": "^3.1.0",
3432
"file-loader": "^4.2.0",
3533
"fork-ts-checker-notifier-webpack-plugin": "^1.0.2",
3634
"fork-ts-checker-webpack-plugin": "^1.5.0",

packages/yab-dev-tools-api/.eslintrc.json

-8
This file was deleted.

packages/yab-dev-tools-api/__tests__/.eslintrc.json

-11
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"module": "esnext",
5+
"lib": ["esnext", "dom"]
6+
},
7+
"include": ["src", "__tests__"]
8+
}

packages/yab-dev-tools-ui/.eslintrc.json

-10
This file was deleted.

0 commit comments

Comments
 (0)