Skip to content

Commit 7b6a225

Browse files
committedJun 21, 2023
fix: fixed logging of "to disable this message..."
Signed-off-by: prisis <d.bannert@anolilab.de>
1 parent 879c116 commit 7b6a225

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed
 

‎packages/eslint-config/src/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,13 @@ if (!global.hasAnolilabEsLintConfigLoaded) {
4141
].forEach((plugin) => consolePlugin(plugin));
4242
}
4343

44+
let hasLogged = false;
45+
4446
Object.entries(possiblePluginRules).forEach(([plugin, dependencies]) => {
4547
const hasOneDependency = Object.values(dependencies).some(Boolean);
4648

4749
if (hasOneDependency) {
50+
hasLogged = true;
4851
consoleLog(
4952
`\nYour package.json container dependencies for the "${plugin}" eslint-plugin, please add the following dependencies with your chosen package manager to enable this plugin:`,
5053
);
@@ -57,7 +60,7 @@ if (!global.hasAnolilabEsLintConfigLoaded) {
5760
}
5861
});
5962

60-
if (Object.keys(possiblePluginRules).length > 0) {
63+
if (hasLogged) {
6164
consoleLog("\nTo disable this message, add the following to your package.json:");
6265
consoleLog(' "anolilab": { "eslint-config": { plugin: { "plugin-name": false } } }\n');
6366
}

‎tsup.config.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@ import { defineConfig as baseDefineConfig } from "tsup";
55

66
import tsconfig from "./tsconfig.json";
77

8-
function getPackageSources(packageContent: NormalizedPackageJson) {
8+
const getPackageSources = (packageContent: NormalizedPackageJson): string[] => {
99
if (typeof packageContent["source"] === "string") {
1010
return [packageContent["source"]];
1111
}
1212

1313
if (Array.isArray(packageContent["sources"])) {
14-
return packageContent["sources"];
14+
return packageContent["sources"] as string[];
1515
}
1616

1717
throw new TypeError("Please define a source or sources key in the package.json.");
1818
}
1919

20-
// @ts-expect-error
2120
export const createConfig = (config?: Object & Options) =>
2221
baseDefineConfig((options: Options) => {
2322
const packageJsonContent = readPackageSync(options as NormalizeOptions);
@@ -39,20 +38,20 @@ export const createConfig = (config?: Object & Options) =>
3938
],
4039
format: ["esm", "cjs"],
4140
silent: !options.watch,
42-
minify: process.env.NODE_ENV === "production",
41+
minify: process.env["NODE_ENV"] === "production",
4342
incremental: !options.watch,
4443
dts: true,
4544
sourcemap: true,
4645
clean: true,
4746
splitting: true,
4847
target: tsconfig.compilerOptions.target as "es2021",
4948
env: {
50-
NODE_ENV: process.env.NODE_ENV,
49+
NODE_ENV: process.env["NODE_ENV"] as string,
5150
...config?.env,
5251
},
5352
declaration: true,
5453
esbuildOptions(options) {
55-
if (process.env.NODE_ENV !== "production" && peerDependenciesKeys.includes("react")) {
54+
if (process.env["NODE_ENV"] !== "production" && peerDependenciesKeys.includes("react")) {
5655
options.tsconfig = options.tsconfig?.replace("tsconfig.json", "tsconfig.dev.json");
5756
}
5857
},

0 commit comments

Comments
 (0)
Please sign in to comment.