Skip to content

Added README.md and architecture docs for --editor #288

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

Merged
merged 1 commit into from
Dec 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ TSLint rules without ESLint equivalents will be wrapped with [eslint-plugin-tsli
Each of these flags is optional:

- **[`config`](#config)**: Path to print the generated ESLint configuration file to.
- **[`editor`](#editor)**: Path to an editor configuration file to convert linter settings within.
- **[`eslint`](#eslint)**: Path to an ESLint configuration file to read settings from.
- **[`package`](#package)**: Path to a package.json file to read dependencies from.
- **[`tslint`](#tslint)**: Path to a TSLint configuration file to read settings from.
Expand All @@ -59,6 +60,17 @@ The file extension of this path will be used to determine the format of the crea
- `.js` file paths will be written `module.exports = ...` JavaScript
- Other file paths will default to JSON

#### `editor`

```shell
npx tslint-to-eslint-config --editor ./path/to/.vscode/settings.json
```

_Default: `.vscode/settings.json`_

Path to an editor configuration file to convert settings settings within.
Any VS Code style editor settings for TSLint will be converted to their ESLint equivalents.

#### `eslint`

```shell
Expand Down
10 changes: 8 additions & 2 deletions docs/Architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

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`.
3. Linter configuration conversion is run by `src/conversion/convertConfig.ts`.
4. Editor configuration conversion is run by `src/conversion/convertEditorConfig.ts`.

## Configuration Conversion
## Linter Configuration Conversion

Within `src/conversion/convertConfig.ts`, the following steps occur:

Expand Down Expand Up @@ -46,3 +47,8 @@ It's possible that one ESLint rule will be output by multiple converters.
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.

## Editor Configuration Conversion

Editor lint configurations are converted by `src/editorSettings/convertEditorSettings.ts`.
Any setting that matches a known built-in TSLint setting will be replaced with the ESLint equivalent.