Skip to content

Commit 094b253

Browse files
feat: much more ESLint config configurability (#867)
## PR Checklist - [x] Addresses an existing open issue: fixes #864; fixes #866 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md) were taken ## Overview Adds: - `--exclude-lint-deprecation` - `--exclude-lint-eslint` - `--exclude-lint-jsdoc` - `--exclude-lint-regex` - `--exclude-lint-strict` - `--exclude-lint-stylistic` Assorted cleanups: * Removes `eslint-config-prettier` since I believe none of the recommended configs include rules impacted by it (yay!) * Removes `eslint-plugin-import` as TypeScript's `"moduleResolution": "NodeNext"` will report on a missing file extension in an import * As of eslint-community/eslint-plugin-n#24 I don't think `n/no-missing-import` is buggy enough to need to be disabled * eslint-community/eslint-plugin-n#84 is still in effect, but this template doesn't use `paths`. * Removes the ESLint config comment now that most users are on a simpler "common" config * Finally add some high-level unit testing for `createESLintRC` to help validate the changes
1 parent cc0cbaf commit 094b253

18 files changed

+430
-268
lines changed

.eslintrc.cjs

+1-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ module.exports = {
2121
"plugin:perfectionist/recommended-natural",
2222
"plugin:regexp/recommended",
2323
"plugin:vitest/recommended",
24-
"prettier",
2524
],
2625
overrides: [
2726
{
@@ -128,7 +127,6 @@ module.exports = {
128127
plugins: [
129128
"@typescript-eslint",
130129
"deprecation",
131-
"import",
132130
"jsdoc",
133131
"no-only-tests",
134132
"perfectionist",
@@ -140,14 +138,13 @@ module.exports = {
140138
rules: {
141139
// These off/less-strict-by-default rules work well for this repo and we like them on.
142140
"@typescript-eslint/no-unused-vars": ["error", { caughtErrors: "all" }],
143-
"import/extensions": ["error", "ignorePackages"],
144141
"no-only-tests/no-only-tests": "error",
145142

146143
// These on-by-default rules don't work well for this repo and we like them off.
147-
"n/no-missing-import": "off",
148144
"no-case-declarations": "off",
149145
"no-constant-condition": "off",
150146
"no-inner-declarations": "off",
147+
"no-mixed-spaces-and-tabs": "off",
151148

152149
// Stylistic concerns that don't interfere with Prettier
153150
"@typescript-eslint/padding-line-between-statements": [

docs/Options.md

+6
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,14 @@ Alternately, you can bypass that prompt by providing any number of the following
7979
- `--exclude-lint-knip`: Don't add Knip to detect unused files, dependencies, and code exports.
8080
- `--exclude-lint-md`: Don't apply linting to `*.md` files.
8181
- `--exclude-lint-package-json`: Don't add npm-package-json-lint to lint for package.json correctness.
82+
- `--exclude-lint-deprecation`: Don't use eslint-plugin-deprecation to report on usage of code marked as `@deprecated`.
83+
- `--exclude-lint-eslint`: Don't use eslint-plugin-eslint-comment to enforce good practices around ESLint comment directives.
84+
- `--exclude-lint-jsdoc`: Don't use eslint-plugin-jsdoc to enforce good practices around JSDoc comments.
8285
- `--exclude-lint-packages`: Don't add a pnpm dedupe workflow to ensure packages aren't duplicated unnecessarily.
8386
- `--exclude-lint-perfectionist`: Don't apply eslint-plugin-perfectionist to ensure imports, keys, and so on are in sorted order.
87+
- `--exclude-lint-regex`: Don't add eslint-plugin-regex to enforce good practices around regular expressions.
88+
- `--exclude-lint-strict`: Don't augment the recommended logical lint rules with typescript-eslint's strict config.
89+
- `--exclude-lint-stylistic`: Don't add stylistic rules such as typescript-eslint's stylistic config.
8490
- `--exclude-lint-spelling`: Don't add cspell to spell check against dictionaries of known words.
8591
- `--exclude-lint-yml`: Don't apply linting and sorting to `*.yaml` and `*.yml` files.
8692
- `--exclude-releases`: Don't add release-it to generate changelogs, package bumps, and publishes based on conventional commits.

package.json

-2
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,8 @@
7575
"console-fail-test": "^0.2.3",
7676
"cspell": "^7.0.1",
7777
"eslint": "^8.48.0",
78-
"eslint-config-prettier": "^9.0.0",
7978
"eslint-plugin-deprecation": "^2.0.0",
8079
"eslint-plugin-eslint-comments": "^3.2.0",
81-
"eslint-plugin-import": "^2.28.1",
8280
"eslint-plugin-jsdoc": "^46.5.0",
8381
"eslint-plugin-jsonc": "^2.9.0",
8482
"eslint-plugin-markdown": "^3.0.1",

pnpm-lock.yaml

+1-212
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)