Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tslint-to-eslint-config

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tslint-to-eslint-config - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

docs/Dependencies.md

16

.eslintrc.js

@@ -6,3 +6,11 @@ module.exports = {

},
extends: ["airbnb-base", "eslint-config-prettier", "plugin:@typescript-eslint/recommended"],
extends: ["airbnb-base", "eslint-config-prettier", "plugin:@typescript-eslint/all"],
overrides: [
{
files: ["*.stubs.ts", "*.test.ts"],
rules: {
"@typescript-eslint/promise-function-async": 0,
},
},
],
parser: "@typescript-eslint/parser",

@@ -14,7 +22,13 @@ parserOptions: {

rules: {
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/generic-type-naming": 0,
"@typescript-eslint/indent": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-extra-parens": 0,
"@typescript-eslint/no-magic-numbers": 0,
"@typescript-eslint/no-parameter-properties": 0,
"@typescript-eslint/no-type-alias": 0,
"@typescript-eslint/no-use-before-define": 0,
"@typescript-eslint/prefer-for-of": 1,
"@typescript-eslint/prefer-interface": 0,

@@ -21,0 +35,0 @@ "default-case": 0,

@@ -0,0 +0,0 @@ # Contributor Covenant Code of Conduct

@@ -0,0 +0,0 @@ <!--

@@ -0,0 +0,0 @@ {

module.exports = {
presets: [["@babel/preset-env", { targets: { node: "current" } }], "@babel/preset-typescript"],
};

@@ -5,11 +5,45 @@ # Architecture

- CLI usage starts in `bin/tslint-to-eslint-config`, which immediately calls `src/cli/main.ts`.
- CLI settings are parsed and read in `src/cli/runCli.ts`.
- Application logic is run by `src/conversion/convertConfig.ts`.
1. CLI usage starts in `bin/tslint-to-eslint-config`, which immediately calls `src/cli/main.ts`.
2. CLI settings are parsed and read in `src/cli/runCli.ts`.
3. Application logic is run by `src/conversion/convertConfig.ts`.
## Dependencies
## Configuration Conversion
Methods are created using a variant of [Dependency Injection](http://en.wikipedia.org/wiki/Dependency_Injection).
Any method with dependencies that should be stubbed out during tests, such as file system bindings, logging, or other methods,
takes in a first argument of name `dependencies`.
Its dependencies object is manually created in `src/cli/main.ts` and bound to the method with `bind`.
Within `src/conversion/convertConfig.ts`, the following steps occur:
1. Existing configurations are read from disk
2. TSLint rules are converted into their ESLint configurations
3. ESLint configurations are simplified based on extended ESLint presets
4. The simplified configuration is written to the output config file
5. A summary of the results is printed to the user's console
### Conversion Results
The overall configuration generated by steps 2-3 and printed in 4-5 contains the following information:
### Rule Converters
Each TSLint rule should output at least one ESLint rule as the equivalent.
"Converters" for TSLint rules are located in `src/rules/converters/`, and keyed under their names by the map in `src/rules/converters.ts`.
Each converter for a TSLint rule takes an arguments object for the rule, and returns an array of objects containing:
- `rules`: At least one equivalent ESLint rule and options
- `notices`: Any extra info that should be printed after conversion
- `plugins`: Any plugins that should now be installed if not already
The `rules` output is an array of objects containing:
- `ruleName`: Equivalent ESLint rule name that should be enabled
- `ruleArguments`: Any arguments for that ESLint rule
Multiple objects must be supported because some general-use TSLint rules can only be represented by two or more ESLint rules.
For example, TSLint's `no-banned-terms` is represented by ESLint's `no-caller` and `no-eval`.
### Rule Mergers
It's possible that one ESLint rule will be output by multiple converters.
"Mergers" for those ESLint rules should take in two configurations to the same rule and output the equivalent single configuration.
These are located in `src/rules/mergers/`, and keyed under their names by the map in `src/rules/mergers.ts`.
For example, `@typescript-eslint/ban-types` spreads both arguments' `types` members into one large `types` object.

7

docs/Development.md

@@ -22,5 +22,6 @@ # Development

## More Reading
## Further Reading
- [Architecture](./Architecture.md)
- [Testing](./Testing.md)
- [Architecture](./Architecture.md): How the general app structure operates
- [Dependencies](./Dependencies.md): How functions pass and receive static dependencies
- [Testing](./Testing.md): Unit and end-to-end tests

@@ -21,1 +21,21 @@ # Testing

- `src/**/*.stubs.ts`
See [Dependencies](./Dependencies.md) for how static dependencies are stubbed out in functions.
That system is how functions can receive stubs and spies during unit tests.
## End-to-End Tests
```shell
npm run test:end-to-end
```
End-to-end tests that execute the `bin/tslint-to-eslint` command and validate outputs are generated from the directories in `test/tests/`.
Each directory there contains:
- `.eslintrc.json`: `.gitignore`d output from the most recent test run
- `expected.json`: Expected output ESLint configuration
- `stderr.txt`: Any output written to the process `stderr`
- `stdout.txt`: Any output written to the process `stdout`
- `tslint.json`: Original TSLint configuration file to convert
Within each directory, a test suite will execute `bin/tslint-to-eslint` and validate the outputs match what's on disk.

@@ -0,0 +0,0 @@ module.exports = {

@@ -0,0 +0,0 @@ MIT License

@@ -30,3 +30,3 @@ {

"jest": "24.8.0",
"lint-staged": "9.0.2",
"lint-staged": "9.1.0",
"prettier": "1.18.2",

@@ -70,3 +70,3 @@ "strip-ansi": "5.2.0",

},
"version": "0.1.8"
"version": "0.1.9"
}

@@ -0,0 +0,0 @@ # tslint-to-eslint-config

@@ -0,0 +0,0 @@ {

@@ -0,0 +0,0 @@ import * as fs from "fs";

@@ -0,0 +0,0 @@ import * as cp from "child_process";

@@ -0,0 +0,0 @@ import * as fs from "fs";

@@ -0,0 +0,0 @@ module.exports = {

@@ -0,0 +0,0 @@ import * as fs from "fs";

✨ 17 rules replaced with their ESLint equivalents. ✨
️👀 2 rules do not yet have ESLint equivalents; defaulting to eslint-plugin-tslint. 👀
✅ All is well! ✅

@@ -0,0 +0,0 @@ {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc