Skip to content

Commit

Permalink
feat!: bump deps, use object spread, add alauda browserslist
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Jan 26, 2021
1 parent d374d62 commit fb20a50
Show file tree
Hide file tree
Showing 34 changed files with 1,115 additions and 1,108 deletions.
1 change: 0 additions & 1 deletion .browserslistrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
extends @1stg/browserslist-config/modern
>0%
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"scripts": {
"check": "run-p check:*",
"check:eslint": "eslint --print-config .eslintrc.js | eslint-config-prettier-check",
"check:eslint": "eslint-config-prettier .eslintrc.js",
"check:stylelint": "stylelint-config-prettier-check",
"check:tslint": "tslint-config-prettier-check ./tslint.json",
"lint": "run-p lint:*",
Expand All @@ -25,25 +25,25 @@
"type-coverage": "type-coverage --cache --detail --ignore-catch --ignore-files '**/*.d.ts' --strict"
},
"devDependencies": {
"@angular/core": "^11.0.2",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.10",
"@angular/core": "^11.1.0",
"@types/jest": "^26.0.20",
"@types/node": "^14.14.22",
"@types/react": "^17.0.0",
"@types/unist": "^2.0.3",
"core-js": "^3.8.0",
"core-js": "^3.8.3",
"lerna": "^3.22.1",
"npm-run-all": "^4.1.5",
"react": "^17.0.1",
"ts-jest": "^26.4.4",
"tslint": "^6.1.3",
"type-coverage": "^2.14.5",
"typescript": "^4.1.2",
"type-coverage": "^2.14.9",
"typescript": "^4.1.3",
"vue": "^2.6.12",
"yarn-deduplicate": "^3.1.0"
},
"resolutions": {
"@babel/core": "^7.12.9",
"prettier": "^2.2.0"
"@babel/core": "^7.12.10",
"prettier": "^2.2.1"
},
"typeCoverage": {
"atLeast": 100
Expand Down
6 changes: 3 additions & 3 deletions packages/app-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"@1stg/stylelint-config": "^0.13.0",
"@pkgr/es-modules": "^0.3.3",
"@pkgr/imagemin": "^0.4.5",
"browserslist": "^4.14.7",
"postcss": "^8.1.10",
"stylelint": "^13.8.0"
"browserslist": "^4.16.1",
"postcss": "^8.2.4",
"stylelint": "^13.9.0"
},
"publishConfig": {
"access": "public"
Expand Down
10 changes: 3 additions & 7 deletions packages/babel-preset/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ module.exports = declare(

const proposalTypeScriptPreset = require('babel-preset-proposal-typescript')

const proposalTsOptions = Object.assign({
classLoose,
decoratorsLegacy,
isTSX,
})
const proposalTsOptions = { classLoose, decoratorsLegacy, isTSX }

const presets = [
[proposalTypeScriptPreset, proposalTsOptions],
Expand Down Expand Up @@ -121,7 +117,7 @@ module.exports = declare(
if (importOptions === true) {
plugins.push([importPlugin, DEFAULT_ANTD_OPTIONS])
} else if (Array.isArray(importOptions)) {
plugins.push([importPlugin, DEFAULT_ANTD_OPTIONS].concat(importOptions))
plugins.push([importPlugin, DEFAULT_ANTD_OPTIONS, ...importOptions])
} else {
plugins.push(
[
Expand Down Expand Up @@ -174,7 +170,7 @@ module.exports = declare(
presets: [
[
proposalTypeScriptPreset,
Object.assign({}, proposalTsOptions, { isTSX: true }),
{ ...proposalTsOptions, isTSX: true },
],
],
plugins: reactPlugin ? [reactPlugin] : undefined,
Expand Down
10 changes: 5 additions & 5 deletions packages/babel-preset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"dependencies": {
"@babel/helper-plugin-utils": "^7.10.4",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-decorators": "^7.12.1",
"@babel/preset-env": "^7.12.7",
"@babel/preset-react": "^7.12.7",
"@babel/plugin-proposal-decorators": "^7.12.12",
"@babel/preset-env": "^7.12.11",
"@babel/preset-react": "^7.12.10",
"@babel/preset-typescript": "^7.12.7",
"@pkgr/utils": "^0.4.5",
"@vue/babel-helper-vue-jsx-merge-props": "^1.2.1",
Expand All @@ -26,8 +26,8 @@
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"babel-plugin-transform-remove-console": "^6.9.4",
"babel-plugin-transform-typescript-metadata": "^0.3.1",
"babel-preset-proposal-typescript": "^1.5.0",
"core-js": "^3.8.0",
"babel-preset-proposal-typescript": "^2.0.0",
"core-js": "^3.8.3",
"fast-async": "^7.0.6"
},
"publishConfig": {
Expand Down
4 changes: 4 additions & 0 deletions packages/browserslist-config/alauda.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* @see http://confluence.alauda.cn/pages/viewpage.action?pageId=67557669
*/
module.exports = ['Chrome >= 85', 'Firefox >= 80']
8 changes: 1 addition & 7 deletions packages/browserslist-config/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
module.exports = [
'defaults',
'last 5 versions',
'> 0.5% in CN',
// it seems out of date too long
'not and_qq < 2',
]
module.exports = ['defaults', 'last 5 versions', '> 0.5% in CN']
9 changes: 1 addition & 8 deletions packages/browserslist-config/latest.js
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
module.exports = [
'last 1 Android version',
'last 1 Chrome version',
'last 1 ChromeAndroid version',
'last 1 FireFox version',
'last 1 iOS version',
'last 1 Safari version',
]
module.exports = ['defaults and last 1 version']
22 changes: 5 additions & 17 deletions packages/browserslist-config/modern.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
module.exports = require('.')
.filter(_ => !(_.includes('last') || _.includes('CN')))
.concat(
'> 1%',
'last 3 versions',
'not and_qq < 2',
'not and_uc < 13',
'not baidu < 8',
'not bb < 11',
'not ie <= 11',
'not ie_mob <= 11',
'not kaios < 3',
'not op_mini all',
'not op_mob < 50',
'not safari < 6',
'not samsung < 10',
)
module.exports = [
require('.')
.filter(_ => !_.includes('last') && !_.includes('CN'))
.join(',') + ' and > 1% and last 3 versions and supports es6-module',
]
18 changes: 8 additions & 10 deletions packages/commitlint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ const lernaScopesConfig = require('@commitlint/config-lerna-scopes')
const MERGE_PROPERTIES = ['rules', 'utils']

module.exports = isPkgAvailable('lerna')
? Object.assign(
{},
conventionalConfig,
MERGE_PROPERTIES.reduce((config, property) => {
config[property] = Object.assign(
{},
conventionalConfig[property],
lernaScopesConfig[property],
)
? {
...conventionalConfig,
...MERGE_PROPERTIES.reduce((config, property) => {
config[property] = {
...conventionalConfig[property],
...lernaScopesConfig[property],
}
return config
}, {}),
)
}
: conventionalConfig
12 changes: 6 additions & 6 deletions packages/common-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
"@1stg/prettier-config": "^0.11.0",
"@1stg/remark-config": "^0.6.0",
"@1stg/tsconfig": "^0.10.3",
"@babel/core": "^7.12.9",
"eslint": "^7.14.0",
"husky": "^4.3.0",
"lint-staged": "^10.5.2",
"prettier": "^2.2.0",
"tslib": "^2.0.0"
"@babel/core": "^7.12.10",
"eslint": "^7.18.0",
"husky": "^4.3.8",
"lint-staged": "^10.5.3",
"prettier": "^2.2.1",
"tslib": "^2.1.0"
},
"publishConfig": {
"access": "public"
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config/_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ if (isMonorepo) {
return acc
}
const { name, peerDependencies = {}, dependencies = {} } = pkgJson
// eslint-disable-next-line unicorn/prefer-spread
return acc.concat(
name,
Object.keys(peerDependencies),
Expand Down
3 changes: 2 additions & 1 deletion packages/eslint-config/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ module.exports = {
'node/no-unpublished-import': 0,
'node/no-unpublished-require': 0,
'prefer-const': 2,
'prefer-object-spread': 2,
'unicorn/catch-error-name': [
2,
{
Expand All @@ -92,8 +93,8 @@ module.exports = {
ignore: [/^[A-Z](([\dA-Z]+_)*[\dA-Z]+)?\.mdx?$/],
},
],
'unicorn/no-array-reduce': 0,
'unicorn/no-null': 0,
'unicorn/no-reduce': 0,
'unicorn/prevent-abbreviations': 0,
},
}
88 changes: 41 additions & 47 deletions packages/eslint-config/overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,28 @@ const configFile =

const jsBase = {
files: '*.{mjs,js,jsx}',
parser: 'babel-eslint',
parser: '@babel/eslint-parser',
parserOptions: configFile && {
babelOptions: {
configFile,
},
},
plugins: ['babel'],
plugins: ['@babel'],
extends: ['prettier/babel'],
rules: {
camelcase: 0,
'new-cap': 0,
'no-invalid-this': 0,
'no-unused-expressions': 0,
'valid-typeof': 0,
'babel/camelcase': [
camelcase: [
2,
{
properties: 'never',
ignoreDestructuring: true,
},
],
'babel/new-cap': 2,
'babel/no-invalid-this': 2,
'babel/no-unused-expressions': 2,
'babel/valid-typeof': 2,
'new-cap': 0,
'no-invalid-this': 0,
'no-unused-expressions': 0,
'@babel/new-cap': 2,
'@babel/no-invalid-this': 2,
'@babel/no-unused-expressions': 2,
},
}

Expand All @@ -63,9 +60,9 @@ const resolveSettings = {
'node_modules/@types',
],
'import/resolver': {
ts: {
typescript: {
alwaysTryTypes: true,
directory: project,
project,
},
},
node: {
Expand Down Expand Up @@ -249,12 +246,10 @@ exports.tslint = {
files: '*.{ts,tsx}',
excludedFiles: '*.d.ts',
plugins: TSLINT_CONFIG ? ['@typescript-eslint/tslint'] : undefined,
rules: Object.assign(
{
// `ordered-imports` of tslint is better for now
'import/order': 0,
},
TSLINT_CONFIG
rules: {
// `ordered-imports` of tslint is better for now
'import/order': 0,
...(TSLINT_CONFIG
? undefined
: {
'@typescript-eslint/tslint/config': [
Expand All @@ -263,8 +258,8 @@ exports.tslint = {
lintFile,
},
],
},
),
}),
},
}

exports.angular = [
Expand Down Expand Up @@ -301,22 +296,20 @@ const reactJsx = {
}

exports.react = [
Object.assign(
{
files: '*.{js,jsx,tsx}',
rules: {
'react/jsx-boolean-value': [2, 'always'],
'react/jsx-handler-names': [
2,
{
eventHandlerPrefix: false,
eventHandlerPropPrefix: 'on',
},
],
},
{
files: '*.{js,jsx,tsx}',
rules: {
'react/jsx-boolean-value': [2, 'always'],
'react/jsx-handler-names': [
2,
{
eventHandlerPrefix: false,
eventHandlerPropPrefix: 'on',
},
],
},
reactJsx,
),
...reactJsx,
},
{
files: '*.tsx',
rules: {
Expand Down Expand Up @@ -345,29 +338,29 @@ exports.reactTs = {
const vueExtends = ['plugin:vue/recommended', 'prettier', 'prettier/vue']

exports.vue = [
Object.assign({}, jsBase, {
{
...jsBase,
parser: 'vue-eslint-parser',
parserOptions: Object.assign({}, jsBase.parserOptions, {
parser: jsBase.parser,
}),
parserOptions: { ...jsBase.parserOptions, parser: jsBase.parser },
extends: vueExtends,
}),
Object.assign({}, tsBase, {
},
{
...tsBase,
parser: 'vue-eslint-parser',
files: '*.{vue,ts,tsx}',
parserOptions: {
parser: '@typescript-eslint/parser',
extraFileExtensions: ['.vue'],
},
extends: tsBase.extends.concat(vueExtends),
}),
extends: [...tsBase.extends, ...vueExtends],
},
]

exports.mdx = {
files: '*.{md,mdx}',
extends: reactJsx.extends.concat('plugin:mdx/recommended'),
extends: [...reactJsx.extends, 'plugin:mdx/recommended'],
parserOptions: jsBase.parserOptions,
settings: Object.assign({}, reactJsx.settings, resolveSettings),
settings: { ...reactJsx.settings, ...resolveSettings },
}

const nonSourceRules = {
Expand Down Expand Up @@ -398,6 +391,7 @@ exports.config = {
}

exports.overrides = []
// eslint-disable-next-line unicorn/prefer-spread
.concat(
isPkgAvailable('@babel/core') && exports.js,
isTsAvailable && exports.ts,
Expand Down
Loading

0 comments on commit fb20a50

Please sign in to comment.