linter-bundle
Version:
Ready-to use bundle of linting tools, containing configurations for ESLint, stylelint and markdownlint.
69 lines (50 loc) • 3.21 kB
Markdown
<!-- markdownlint-disable -->
- Dateien ignorieren, die nicht zu git hochgeladen werden.
z.B. sollte der Markdownlinter die TODO.md ignorieren
Aktivierung dieser Regeln: https://eslint.style/packages/plus
shared-settings für linter-bundle custom settings verwenden?
https://eslint.org/blog/2022/08/new-config-system-part-2/#shared-settings-are-exactly-the-same
---
- Aktuell sind die Versionen von den Audit-Tools hardcodiert in der lint.js hinterlegt:
'better-npm-audit@3.7.3',
'improved-yarn-audit@3.0.0',
Das sollte irgendwo hinterlegt werden, so z.B. check-outdated drauf zugreifen kann. (z.B. die optionalDependencies? Sind diese nach dem regulären Installieren noch vorhanden und lassen sich entsprechend auslesen? Werden diese von check-outdated geprüft?)
- Timing funktioniert nicht - siehe HexEd.it-core
- Wie erreichen wir auto-completion in der .linter-bundle.js datei?
.linter-bundle.json vielleicht mit Schema-Datei?
<!-- markdownlint-disable -->
- Bereiche in Readme aufklappbar machen:
<details>
summary>yarn</summary>
```shell
yarn add click-to-react-component
```
</details>
- Make git diff-branch configurable
on GitHub Actions this could be used:
- run: git diff --name-only -z origin/${GITHUB_BASE_REF}
Is there a variable with includes origin/ already?
Some tools like Gatsby ship deprecated dependencies of eslint and @typescript-eslint.
Since npm installs packages alphabetically, the outdated `gatsby` dependencies are installed in the `node_modules` root, instead of the newer `linter-bundle` dependencies. Since the old versions often do not support new rules or new options, this may cause linting to fail with errors like this:
```bash
Error while loading rule 'import/no-unused-modules': .eslintrc.js » ./node_modules/linter-bundle/eslint/index.js:
Configuration for rule "@typescript-eslint/no-throw-literal" is invalid:
Value [{"allowThrowingAny":false,"allowThrowingUnknown":true}] should NOT have more than 0 items.
```
To solve such problems, npm supports [`overrides`](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides) as of version [8.3](https://github.com/npm/cli/releases/tag/v8.3.0), while yarn supports [`resolutions`](https://classic.yarnpkg.com/en/docs/selective-version-resolutions/).
By using the `enforce-deps` option, linter-bundle will ensure the right versions of the dependencies are installed, and if not it automatically write these options to your package.json and then run an `npm i` or `yarn`, before starting the linting to ensure that the correct dependency versions are installed.
```json
"overrides": {
"@typescript-eslint/eslint-plugin": "$linter-bundle",
"@typescript-eslint/parser": "$linter-bundle",
"eslint": "$linter-bundle"
}
```
- Option to lint only changed files in Git
- [lint-staged](https://github.com/okonet/lint-staged)
- [affected](https://www.npmjs.com/package/affected)
- [git-affected-files](https://www.npmjs.com/package/git-affected-files)
- [affected-files](https://www.npmjs.com/package/affected-files)
- [is-affected](https://www.npmjs.com/package/is-affected)
- Find stylelint rule which checks for wrong values like:
`padding-top: 3px 3px 0;`