Skip to content

Commit 0ac81b3

Browse files
fix: lint .eslintrc.cjs (#543)
## PR Checklist - [x] Addresses an existing open issue: fixes #537 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/template-typescript-node-package/blob/main/.github/CONTRIBUTING.md) were taken ## Overview Changes the `pnpm run lint` command to explicitly include dotfiles. I don't like making the command more complex, but I couldn't figure out a way to get it to include dotfiles... fortunately, once [ESLint flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new) is usable, we can switch to that and remove the change to the `lint` script. Filed azat-io/eslint-plugin-perfectionist#22 as part of this.
1 parent 4d0d1ac commit 0ac81b3

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

.eslintrc.cjs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module.exports = {
2121
"plugin:regexp/recommended",
2222
"prettier",
2323
],
24+
/* eslint-disable perfectionist/sort-objects -- https://github.com/azat-io/eslint-plugin-perfectionist/issues/22 */
2425
overrides: [
2526
{
2627
extends: ["plugin:markdown/recommended"],
@@ -46,11 +47,11 @@ module.exports = {
4647
},
4748
},
4849
{
50+
excludedFiles: ["**/*.md/*.ts"],
4951
extends: [
5052
"plugin:@typescript-eslint/recommended-requiring-type-checking",
5153
"plugin:@typescript-eslint/strict",
5254
],
53-
excludedFiles: ["**/*.md/*.ts"],
5455
files: ["**/*.ts"],
5556
parser: "@typescript-eslint/parser",
5657
parserOptions: {
@@ -70,13 +71,13 @@ module.exports = {
7071
},
7172
},
7273
{
73-
files: ["*.json", "*.jsonc"],
7474
excludedFiles: ["package.json"],
75+
extends: ["plugin:jsonc/recommended-with-json"],
76+
files: ["*.json", "*.jsonc"],
7577
parser: "jsonc-eslint-parser",
7678
rules: {
7779
"jsonc/sort-keys": "error",
7880
},
79-
extends: ["plugin:jsonc/recommended-with-json"],
8081
},
8182
{
8283
files: "**/*.test.ts",
@@ -128,8 +129,8 @@ module.exports = {
128129
"no-only-tests/no-only-tests": "error",
129130

130131
// These on-by-default rules don't work well for this repo and we like them off.
131-
"no-constant-condition": "off",
132132
"no-case-declarations": "off",
133+
"no-constant-condition": "off",
133134
"no-inner-declarations": "off",
134135

135136
// Stylistic concerns that don't interfere with Prettier
@@ -139,4 +140,5 @@ module.exports = {
139140
{ blankLine: "always", next: "*", prev: "block-like" },
140141
],
141142
},
143+
/* eslint-enable perfectionist/sort-objects */
142144
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"format": "prettier \"**/*\" --ignore-unknown",
2626
"format:write": "pnpm format --write",
2727
"hydrate:test": "node script/hydrate-test-e2e.js",
28-
"lint": "eslint . --max-warnings 0 --report-unused-disable-directives",
28+
"lint": "eslint . .*js --max-warnings 0 --report-unused-disable-directives",
2929
"lint:knip": "knip",
3030
"lint:md": "markdownlint \"**/*.md\" \".github/**/*.md\" --rules sentences-per-line",
3131
"lint:package": "npmPkgJsonLint .",

src/hydrate/steps/writing/creation/rootFiles.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ module.exports = {
5050
"plugin:regexp/recommended",
5151
"prettier",
5252
],
53+
/* eslint-disable perfectionist/sort-objects -- https://github.com/azat-io/eslint-plugin-perfectionist/issues/22 */
5354
overrides: [
5455
{
5556
extends: ["plugin:markdown/recommended"],
@@ -75,11 +76,11 @@ module.exports = {
7576
},
7677
},
7778
{
79+
excludedFiles: ["**/*.md/*.ts"],
7880
extends: [
7981
"plugin:@typescript-eslint/recommended-requiring-type-checking",
8082
"plugin:@typescript-eslint/strict",
8183
],
82-
excludedFiles: ["**/*.md/*.ts"],
8384
files: ["**/*.ts"],
8485
parser: "@typescript-eslint/parser",
8586
parserOptions: {
@@ -91,13 +92,13 @@ module.exports = {
9192
},
9293
},
9394
{
94-
files: ["*.json", "*.jsonc"],
9595
excludedFiles: ["package.json"],
96+
extends: ["plugin:jsonc/recommended-with-json"],
97+
files: ["*.json", "*.jsonc"],
9698
parser: "jsonc-eslint-parser",
9799
rules: {
98100
"jsonc/sort-keys": "error",
99101
},
100-
extends: ["plugin:jsonc/recommended-with-json"],
101102
},${
102103
values.unitTests
103104
? `\n{
@@ -152,6 +153,7 @@ module.exports = {
152153
}
153154
154155
// These on-by-default rules don't work well for this repo and we like them off.
156+
"no-case-declarations": "off",
155157
"no-constant-condition": "off",
156158
"no-inner-declarations": "off",
157159
@@ -163,6 +165,7 @@ module.exports = {
163165
{ blankLine: "always", next: "*", prev: "block-like" },
164166
],
165167
},
168+
/* eslint-enable perfectionist/sort-objects */
166169
};
167170
`,
168171
".gitignore": formatIgnoreFile([

src/hydrate/steps/writing/creation/writePackageJson.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export async function writePackageJson({
5454
build: "tsc",
5555
format: 'prettier "**/*" --ignore-unknown',
5656
"format:write": "pnpm format --write",
57-
lint: "eslint . --max-warnings 0 --report-unused-disable-directives",
57+
lint: "eslint . .*js --max-warnings 0 --report-unused-disable-directives",
5858
"lint:knip": "knip",
5959
"lint:md":
6060
'markdownlint "**/*.md" ".github/**/*.md" --rules sentences-per-line',

0 commit comments

Comments
 (0)