Skip to content

Commit

Permalink
feat(eslint): enable css/es-x/json-schema-validator/regexp plugins (#100
Browse files Browse the repository at this point in the history
)
  • Loading branch information
JounQin authored Jul 1, 2022
1 parent ba2d066 commit ab745b4
Show file tree
Hide file tree
Showing 9 changed files with 161 additions and 41 deletions.
8 changes: 8 additions & 0 deletions .changeset/lemon-camels-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@1stg/app-config": minor
"@1stg/common-config": minor
"@1stg/eslint-config": minor
"@1stg/lib-config": minor
---

feat(eslint): enable css/es-x/json-schema-validator/regexp plugins
9 changes: 9 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
"globals": {
"Button": false
}
},
{
"files": [
"**/app.json",
"**/angular.json"
],
"rules": {
"json-schema-validator/no-invalid": "off"
}
}
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@angular/core": "^14.0.4",
"@changesets/changelog-github": "^0.4.5",
"@changesets/cli": "^2.23.0",
"@types/jest": "^28.1.3",
"@types/jest": "^28.1.4",
"@types/node": "^18.0.0",
"@types/react": "^18.0.14",
"@types/unist": "^2.0.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/_util.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const path = require('path')
const path = require('node:path')

const {
isMonorepo,
Expand Down
5 changes: 3 additions & 2 deletions packages/eslint-config/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ module.exports = {
extends: [
'eslint:recommended',
'plugin:eslint-comments/recommended',
'plugin:css/recommended',
'plugin:import/recommended',
'plugin:n/recommended',
'plugin:promise/recommended',
'plugin:regexp/recommended',
'plugin:sonarjs/recommended',
isTsAvailable && 'plugin:sonar/recommended',
'plugin:unicorn/recommended',
'standard',
'plugin:prettier/recommended',
].filter(Boolean),
plugins: ['simple-import-sort'],
plugins: ['es-x', 'simple-import-sort'],
globals: isWebpackAvailable ? getGlobals(webpackSpecVars) : undefined,
rules: {
'arrow-body-style': 2,
Expand Down Expand Up @@ -108,7 +110,6 @@ module.exports = {
'unicorn/no-null': 0,
'unicorn/no-unreadable-array-destructuring': 0, // conflict with `no-unused-vars`
'unicorn/prefer-module': 0,
'unicorn/prefer-node-protocol': 0,
'unicorn/prefer-object-from-entries': 0,
'unicorn/prevent-abbreviations': 0,
},
Expand Down
22 changes: 17 additions & 5 deletions packages/eslint-config/overrides.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const path = require('path')
const path = require('node:path')

const {
isAngularAvailable,
Expand Down Expand Up @@ -86,7 +86,7 @@ const resolveSettings = {
}

const tsBase = {
files: ['*.ts', '*.tsx'],
files: ['*.cts', '*.mts', '*.ts', '*.tsx'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
Expand Down Expand Up @@ -257,7 +257,7 @@ exports.ts = [
]

exports.dTs = {
files: '*.d.ts',
files: ['*.d.cts', '*.d.mts', '*.d.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-extraneous-class': 0,
Expand Down Expand Up @@ -487,21 +487,32 @@ exports.config = exports.configs = {
}

exports.json = {
files: '*.json',
files: ['.*rc', '*.json'],
excludedFiles: ['.browserslistrc', '.npmrc', '.nvmrc', '.yarnrc', '.*shrc'],
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:json-schema-validator/recommended',
// eslint-disable-next-line sonarjs/no-duplicate-string
'plugin:jsonc/prettier',
],
}

exports.jsonc = {
files: '*.jsonc',
files: [
'*.jsonc',
'angular.json',
'jsconfig.json',
'settings.json',
'tsconfig.json',
'tsconfig.*.json',
],
extends: [
'plugin:jsonc/auto-config',
'plugin:jsonc/recommended-with-jsonc',
'plugin:json-schema-validator/recommended',
'plugin:jsonc/prettier',
],
}
Expand All @@ -511,6 +522,7 @@ exports.json5 = {
extends: [
'plugin:jsonc/auto-config',
'plugin:jsonc/recommended-with-json5',
'plugin:json-schema-validator/recommended',
'plugin:jsonc/prettier',
],
}
Expand Down
8 changes: 6 additions & 2 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@
"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.1",
"eslint-import-resolver-typescript": "^3.1.2",
"eslint-plugin-css": "^0.6.0",
"eslint-plugin-es-x": "^5.2.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-json-schema-validator": "^3.0.25",
"eslint-plugin-jsonc": "^2.3.0",
"eslint-plugin-markup": "^0.9.0",
"eslint-plugin-mdx": "^2.0.1",
Expand All @@ -40,12 +43,13 @@
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-regexp": "^1.7.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"eslint-plugin-sonar": "^0.8.0",
"eslint-plugin-sonarjs": "^0.13.0",
"eslint-plugin-svelte": "^2.0.0",
"eslint-plugin-toml": "^0.3.1",
"eslint-plugin-unicorn": "^42.0.0",
"eslint-plugin-unicorn": "^43.0.0",
"eslint-plugin-vue": "^9.1.1",
"eslint-plugin-yml": "^1.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/lint-staged/_utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const path = require('path')
const path = require('node:path')

const { isPkgAvailable, tryFile, tryPkg } = require('@pkgr/utils')

Expand Down
Loading

0 comments on commit ab745b4

Please sign in to comment.