-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
migrated tslint to eslint #22
Conversation
|
danger-plugin-digitalcitizenship | Used in package.json |
Author: Federico Feroldi | Description: Shared rules for DangerJS, used in the Digital Citizenship projects |
License: MIT | Homepage: https://github.com/teamdigitale/danger-plugin-digitalcitizenship#readme |
Updated: about 1 month ago | Created: about 4 years ago |
Releases: 4 | Maintainers: 1 |
README
Custom DangerJS rules for io.italia.it projects
This repository is part of the
io.italia.it
project.
Development
Release
The release process is based on npm version:
$ npm version [patch|minor|major]
@pagopa/eslint-config | Used in package.json |
Author: Unknown | Description: This package provide the following ESLint custom rules for Typescript projects. |
License: MIT | Homepage: https://github.com/pagopa/eslint-rules#readme |
Updated: about 2 months ago | Created: over 1 year ago |
Releases: 7 | Maintainers: 4 |
README
PagoPA ESLint config
This package provide the following ESLint custom rules for Typescript projects.
recommendend
react
strong
This repository replace italia-tslint-rules after TSLint deprecation.
The following TSLint rules (included inside italia-tslint-rules
) are not supported for eslint at the moment and are missing in this package:
bool-param-default
max-union-size
no-accessor-field-mismatch
no-array-delete // Mitigated by no-delete
no-case-with-or
no-dead-store
no-duplicate-in-composite
no-empty-array
no-extra-semicolon // Mitigated by prettier
no-empty-destructuring // Mititgated by no-empty-pattern
no-gratuitous-expressions
no-hardcoded-credentials
no-ignored-initial-value // Mitigated by no-param-reassign, no-let
no-in-misuse
no-inferred-empty-object-type
no-invalid-await // Mititgated by await-thenable
no-invariant-return
no-misleading-array-reverse // Mitigated by immutable-data
no-misspelled-operator // Mitigated by prettier
no-nested-switch
no-nested-template-literals
no-statements-same-line // Mitigated by prettier
no-try-promise
no-tslint-disable-all
no-unconditional-jump
no-undefined-argument
no-unenclosed-multiline-block // Mitigated by prettier
no-unthrown-error
no-unused-array // Mitigated by no-unused-vars
no-useless-increment
no-useless-intersection
prefer-promise-shorthand
promise-must-complete
use-primitive-type
This list has been produced following these steps:
- Follow TSLint to ESLint migration guide on the project io-backend
- Running
npx tslint-to-eslint-config
that produces a list of TSLint rules not available for ESLint (77 rules at the moment) - Manually check each one for an alternative ESLint rules/plugins
- Verify each alternative ESLint rule/plugin on a testing file
Usage
Installation and Configuration
To use this package install as devDependecy inside any typescript project with
yarn install -D @pagopa/eslint-config
Create on the project an .eslintrc.js
file with the following content
module.exports = {
"extends": [
"@pagopa/eslint-config/strong",
],
"rules": {
// Any project level custom rule
}
}
Add inside the package.json
file a lint
and optionally a lint-autofix
script as:
"scripts": {
"lint": "eslint . -c .eslintrc.js --ext .ts,.tsx",
"lint-autofix": "eslint . -c .eslintrc.js --ext .ts,.tsx --fix",
...
}
Migration from TSLint
Remove from the package.json
every tslint reference:
tslint
italia-tslint-rules
Replace all the // tslint:disable-next-line
with the proper // eslint-disable-next-line
comment. If are present some // tslint:disable
replace it with /* eslint-disable */
at the top of the file.
If you need to disable ESLint for some files create .eslintignore
file with the list of folders or files that must be excluded from lint process. Copy the exclusion from tslint.json
linterOptions.exclude
Delete all tslint related files (es. tslint.json
).
Run yarn lint-autofix
to refactorize the code automatically with all the auto-fixable ESLint rules.
New dependencies added: @pagopa/eslint-config
, danger-plugin-digitalcitizenship
and eslint-plugin-prettier
.
Example of PR titles that include pivotal stories:
- single story:
[#123456] my PR title
- multiple stories:
[#123456,#123457,#123458] my PR title
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you check old tslint comments within code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! :)
List of Changes
Migrated tslint to eslint
Motivation and Context
such as tslint is deprecated a migration is needed
How Has This Been Tested?
there were no tests in this project, the build went fine and the linter gave me no errors in output
Screenshots (if appropriate):
Types of changes
Checklist: