Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Commit

Permalink
feat: disable deprecation in favor of sonar/deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Mar 2, 2021
1 parent f23f28e commit 32aa1d1
Show file tree
Hide file tree
Showing 7 changed files with 351 additions and 273 deletions.
1 change: 0 additions & 1 deletion .prettierrc

This file was deleted.

14 changes: 14 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const base = require('@1stg/prettier-config')

module.exports = {
...base,
overrides: [
...base.overrides,
{
files: ['sonar.json', 'prettier.json'],
options: {
parser: 'json',
},
},
],
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# tslint-config-eslint

> Yet another TSLint Configuration which disables all rules which has been handled by `eslint` or `@typescript-eslint`
> Yet another TSLint Configuration which disables all rules which has been handled by `eslint`, `@typescript-eslint` or [`eslint-plugin-sonar`](https://github.com/rx-ts/eslint-plugin-sonar)
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/rx-ts/tslint-config-eslint/Publish%20package)](https://github.com/rx-ts/tslint-config-eslint/actions?query=workflow%3A%22Publish+package%22)
[![Codacy Grade](https://img.shields.io/codacy/grade/5c70cd4efc864eb3b344e32be9aecce8)](https://www.codacy.com/app/JounQin/tslint-config-eslint)
Expand Down
16 changes: 13 additions & 3 deletions build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ const CORE_REPLACEMENTS = CORE_AS_IS_REPLACEMENTS.reduce(
},
)

const ADDITIONAL_AS_IS_REPLACEMENTS = [
// from `@typescript-eslint/eslint-plugin`
const ADDITIONAL_TS_AS_IS_REPLACEMENTS = [
'adjacent-overload-signatures',
'array-type',
'ban-ts-ignore',
Expand Down Expand Up @@ -101,7 +102,7 @@ const ADDITIONAL_AS_IS_REPLACEMENTS = [
'use-isnan',
]

const ADDITIONAL_REPLACEMENTS = ADDITIONAL_AS_IS_REPLACEMENTS.reduce(
const ADDITIONAL_TS_REPLACEMENTS = ADDITIONAL_TS_AS_IS_REPLACEMENTS.reduce(
(rules, rule) => Object.assign(rules, { [rule]: rule }),
{
'await-promise': 'await-thenable',
Expand Down Expand Up @@ -133,9 +134,18 @@ const ADDITIONAL_REPLACEMENTS = ADDITIONAL_AS_IS_REPLACEMENTS.reduce(
},
)

// form `eslint-plugin-deprecation`
const ADDITIONAL_SONAR_AS_IS_REPLACEMENTS = ['deprecation']

const ADDITIONAL_SONAR_REPLACEMENTS = ADDITIONAL_SONAR_AS_IS_REPLACEMENTS.reduce(
(rules, rule) => Object.assign(rules, { [rule]: rule }),
{},
)

const DISABLED_RULES = [
...Object.keys(CORE_REPLACEMENTS),
...Object.keys(ADDITIONAL_REPLACEMENTS),
...Object.keys(ADDITIONAL_TS_REPLACEMENTS),
...Object.keys(ADDITIONAL_SONAR_REPLACEMENTS),
].reduce(
(rules, rule) =>
Object.assign(rules, {
Expand Down
22 changes: 15 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@
"lint:ts": "tslint -p . -t stylish",
"lint:tsc": "tsc --noEmit",
"release": "standard-version -a --release-as",
"type-coverage": "type-coverage --cache --detail --ignore-files *.d.ts --strict"
"typecov": "type-coverage"
},
"peerDependencies": {
"@typescript-eslint/eslint-plugin": ">=2.30.0",
"eslint-plugin-sonar": "^0.2.0",
"tslint": ">=5.0.0",
"typescript": ">=3.0.0"
},
"devDependencies": {
"@1stg/common-config": "^1.2.8",
"@1stg/tslint-config": "^1.0.0",
"@1stg/common-config": "^1.2.9",
"@1stg/tslint-config": "^1.0.1",
"@types/node": "^14.14.31",
"core-js": "^3.9.0",
"core-js": "^3.9.1",
"npm-run-all": "^4.1.5",
"standard-version": "^9.1.1",
"ts-node": "^9.1.1",
Expand All @@ -39,12 +40,19 @@
"yarn-deduplicate": "^3.1.0"
},
"resolutions": {
"@babel/core": "^7.13.1",
"@babel/preset-env": "^7.13.5",
"@babel/core": "^7.13.8",
"@babel/preset-env": "^7.13.9",
"prettier": "^2.2.1",
"typescript": "^4.2.2"
},
"typeCoverage": {
"atLeast": 100
"atLeast": 100,
"cache": true,
"detail": true,
"ignoreFiles": [
"*.d.ts"
],
"strict": true,
"update": true
}
}
4 changes: 2 additions & 2 deletions sonar.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"rules": {
"cognitive-complexity": false,
"max-switch-cases": false,
"no-big-function": false,
"no-big-function": false, // max-lines-per-function
"no-collapsible-if": false,
"no-duplicate-string": false,
"no-duplicated-branches": false,
Expand All @@ -13,7 +13,7 @@
"no-redundant-boolean": false,
"no-small-switch": false,
"no-useless-catch": false,
"parameters-max-number": false,
"parameters-max-number": false, // max-params
"prefer-immediate-return": false
}
}
Loading

0 comments on commit 32aa1d1

Please sign in to comment.