Skip to content

Commit

Permalink
feat!: bump plugins (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Jun 30, 2022
1 parent 7a482b6 commit 9c2c16d
Show file tree
Hide file tree
Showing 22 changed files with 1,525 additions and 1,268 deletions.
8 changes: 8 additions & 0 deletions .changeset/chilly-fishes-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@1stg/app-config": major
"@1stg/common-config": major
"@1stg/eslint-config": major
"@1stg/lib-config": major
---

feat!: use official eslint-plugin-prettier and eslint-plugin-svelte v2
5 changes: 5 additions & 0 deletions .changeset/cyan-ravens-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@1stg/remark-config": major
---

feat!: upgrade remark-validate-links v12
5 changes: 5 additions & 0 deletions .changeset/nice-seals-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@1stg/eslint-config": minor
---

feat: enable jsonc/toml/yml plugins
5 changes: 5 additions & 0 deletions .changeset/wild-penguins-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@1stg/lint-staged": major
---

feat!: check eslint and styleint availability to determine whether run prettier on them
4 changes: 4 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ coverage
LICENSE
*.iml
*.json
*.jsonc
*.json5
*.lock
*.log
*.sh
*.svg
*.tsbuildinfo
*.toml
*.yaml
*.yml
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"typecov": "type-coverage"
},
"devDependencies": {
"@angular/compiler": "^14.0.3",
"@angular/compiler-cli": "^14.0.3",
"@angular/core": "^14.0.3",
"@angular/compiler": "^14.0.4",
"@angular/compiler-cli": "^14.0.4",
"@angular/core": "^14.0.4",
"@changesets/changelog-github": "^0.4.5",
"@changesets/cli": "^2.23.0",
"@types/jest": "^28.1.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@1stg/stylelint-config": "^4.3.0",
"@pkgr/es-modules": "^0.6.0",
"@pkgr/imagemin": "^3.1.0",
"browserslist": "^4.21.0",
"browserslist": "^4.21.1",
"postcss": "^8.4.14",
"stylelint": "^14.9.1"
},
Expand Down
12 changes: 6 additions & 6 deletions packages/babel-preset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
"@babel/core": ">=7.14.1"
},
"dependencies": {
"@babel/helper-plugin-utils": "^7.17.12",
"@babel/plugin-proposal-class-properties": "^7.17.12",
"@babel/plugin-proposal-decorators": "^7.18.2",
"@babel/preset-env": "^7.18.2",
"@babel/preset-react": "^7.17.12",
"@babel/preset-typescript": "^7.17.12",
"@babel/helper-plugin-utils": "^7.18.6",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.18.6",
"@babel/preset-env": "^7.18.6",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@pkgr/utils": "^2.2.0",
"@vue/babel-helper-vue-jsx-merge-props": "^1.2.1",
"@vue/babel-plugin-jsx": "^1.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/common-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@1stg/remark-config": "^3.1.0",
"@1stg/simple-git-hooks": "^0.1.2",
"@1stg/tsconfig": "^2.2.0",
"@babel/core": "^7.18.5",
"@babel/core": "^7.18.6",
"@commitlint/cli": "^17.0.3",
"eslint": "^8.18.0",
"lint-staged": "^13.0.3",
Expand Down
53 changes: 45 additions & 8 deletions packages/eslint-config/overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const {
isVueAvailable,
tryFile,
tryPkg,
tryRequirePkg,
} = require('@pkgr/utils')

const { magicNumbers } = require('./_util')
Expand Down Expand Up @@ -355,10 +354,8 @@ exports.vue = [

const svelteBase = {
files: '*.svelte',
plugins: ['svelte'],
processor: 'svelte/svelte',
extends: ['plugin:svelte/recommended'],
rules: {
'prettier/prettier': 0, // https://github.com/sveltejs/eslint-plugin-svelte3/issues/16,
'sonar/label-position': 0,
'sonar/no-labels': 0,
},
Expand All @@ -371,10 +368,6 @@ exports.svelte = isTsAvailable
parserOptions: {
extraFileExtensions: ['.svelte'],
},
settings: {
...tsBase.settings,
'svelte/typescript': tryRequirePkg('typescript'),
},
}
: {
...jsBase,
Expand Down Expand Up @@ -493,6 +486,45 @@ exports.config = exports.configs = {
rules: nonSourceRules,
}

exports.json = {
files: '*.json',
extends: [
// eslint-disable-next-line sonarjs/no-duplicate-string
'plugin:jsonc/auto-config',
'plugin:jsonc/recommended-with-json',
// eslint-disable-next-line sonarjs/no-duplicate-string
'plugin:jsonc/prettier',
],
}

exports.jsonc = {
files: '*.jsonc',
extends: [
'plugin:jsonc/auto-config',
'plugin:jsonc/recommended-with-jsonc',
'plugin:jsonc/prettier',
],
}

exports.json5 = {
files: '*.json5',
extends: [
'plugin:jsonc/auto-config',
'plugin:jsonc/recommended-with-json5',
'plugin:jsonc/prettier',
],
}

exports.toml = {
files: '*.toml',
extends: ['plugin:toml/recommended'],
}

exports.yml = exports.yaml = {
files: ['*.yml', '*.yaml'],
extends: ['plugin:yml/recommended', 'plugin:yml/prettier'],
}

exports.overrides = []
// eslint-disable-next-line unicorn/prefer-spread
.concat(
Expand All @@ -512,5 +544,10 @@ exports.overrides = []
exports.stories,
exports.configs,
exports.dTs,
exports.json,
exports.jsonc,
exports.json5,
exports.toml,
exports.yaml,
)
.filter(Boolean)
17 changes: 10 additions & 7 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,35 @@
"@babel/eslint-parser": "^7.18.2",
"@babel/eslint-plugin": "^7.17.7",
"@pkgr/utils": "^2.2.0",
"@typescript-eslint/eslint-plugin": "^5.29.0",
"@typescript-eslint/parser": "^5.29.0",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"@typescript-eslint/parser": "^5.30.0",
"angular-eslint-template-parser": "^0.1.1",
"eslint-config-prettier": "^8.5.0",
"eslint-config-standard": "^17.0.0",
"eslint-config-standard-jsx": "^11.0.0",
"eslint-config-standard-react": "^11.0.1",
"eslint-formatter-friendly": "^7.0.0",
"eslint-import-resolver-typescript": "^3.1.0",
"eslint-import-resolver-typescript": "^3.1.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.5.3",
"eslint-plugin-jsdoc": "^39.3.3",
"eslint-plugin-jsonc": "^2.3.0",
"eslint-plugin-markup": "^0.9.0",
"eslint-plugin-mdx": "^2.0.0",
"eslint-plugin-mdx": "^2.0.1",
"eslint-plugin-n": "^15.2.3",
"eslint-plugin-prettier": "npm:@rxts/eslint-plugin-prettier@^4.1.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"eslint-plugin-sonar": "^0.8.0",
"eslint-plugin-sonarjs": "^0.13.0",
"eslint-plugin-svelte": "^1.1.2",
"eslint-plugin-svelte": "^2.0.0",
"eslint-plugin-toml": "^0.3.1",
"eslint-plugin-unicorn": "^42.0.0",
"eslint-plugin-vue": "^9.1.1"
"eslint-plugin-vue": "^9.1.1",
"eslint-plugin-yml": "^1.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/lib-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"@1stg/common-config": "^4.4.0",
"@pkgr/rollup": "^3.1.2",
"jest": "^28.1.1"
"jest": "^28.1.2"
},
"publishConfig": {
"access": "public"
Expand Down
21 changes: 15 additions & 6 deletions packages/lint-staged/base.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
const { isPkgAvailable } = require('@pkgr/utils')

const isEslintAvailable = isPkgAvailable('eslint')
const isStylelintAvailable = isPkgAvailable('stylelint')

const ESLINT_FILES = 'cjs,js,jsx,md,mdx,mjs,svelte,vue'
const TS_FILES = 'cts,mts,ts,tsx'
const STYLELINT_FILES = 'css,less,sass,scss,svelte,vue'

const config = [
'*.{*sh,env,env.*,gql,html,json,properties,pug,rb,svelte,vue,toml,yaml,yml}',
`*.{*sh,env,env.*,gql,html,json,properties,pug,rb,toml,yaml,yml${
isEslintAvailable ? '' : ',' + ESLINT_FILES + ',' + TS_FILES
}${isStylelintAvailable ? '' : ',' + STYLELINT_FILES}}`,
'.!(nvm)rc',
'Dockerfile',
].reduce(
Expand All @@ -12,17 +21,17 @@ const config = [
{},
)

if (isPkgAvailable('eslint')) {
if (isEslintAvailable) {
Object.assign(config, {
'*.{cjs,js,jsx,md,mdx,mjs,svelte,vue}': 'eslint --cache -f friendly --fix',
'*.{ts,tsx}': [
[`*.{${ESLINT_FILES}}`]: 'eslint --cache -f friendly --fix',
[`*.{${TS_FILES}}`]: [
'cross-env PARSER_NO_WATCH=true eslint --cache -f friendly --fix',
],
})
}

if (isPkgAvailable('stylelint')) {
config['*.{css,less,sass,scss,vue}'] = 'stylelint --cache --fix'
if (isStylelintAvailable) {
config[`*.{${STYLELINT_FILES}}`] = 'stylelint --cache --fix'
}

if (isPkgAvailable('@pkgr/imagemin')) {
Expand Down
2 changes: 1 addition & 1 deletion packages/prettier-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@prettier/plugin-ruby": "^3.1.2",
"@prettier/plugin-xml": "^2.2.0",
"prettier-plugin-pkg": "^0.14.1",
"prettier-plugin-sh": "^0.12.2",
"prettier-plugin-sh": "^0.12.4",
"prettier-plugin-svelte": "^2.7.0",
"prettier-plugin-toml": "^0.3.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"remark-preset-lint-markdown-style-guide": "^5.1.2",
"remark-preset-lint-recommended": "^6.1.2",
"remark-preset-prettier": "^1.0.1",
"remark-validate-links": "^11.0.2"
"remark-validate-links": "^12.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
3 changes: 3 additions & 0 deletions tests/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"hello": "world"
}
3 changes: 3 additions & 0 deletions tests/test.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
hello: 'world',
}
4 changes: 4 additions & 0 deletions tests/test.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
// comment
"hello": "world"
}
1 change: 1 addition & 0 deletions tests/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello = 'world'
1 change: 1 addition & 0 deletions tests/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello: world
1 change: 1 addition & 0 deletions tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello: world

0 comments on commit 9c2c16d

Please sign in to comment.