@najemi-software/typed-scss-modules 13.8.0 → 13.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/cli.js CHANGED
@@ -121,4 +121,4 @@ const { _: patterns, ...rest } = yargs(hideBin(process.argv))
121
121
  describe: 'Output filenames that will be compatible with the "arbitrary file extensions" feature that was introduced in TypeScript 5.0.',
122
122
  })
123
123
  .parseSync();
124
- main(patterns[0], { ...rest });
124
+ void main(patterns[0], { ...rest });
@@ -24,5 +24,6 @@ const warn = withLogLevelsRestriction(["verbose"], (message) => log(chalk.yellow
24
24
  const notice = withLogLevelsRestriction(["verbose", "info"], (message) => log(chalk.gray(message)));
25
25
  const info = withLogLevelsRestriction(["verbose", "info"], (message) => log(chalk.blueBright(message)));
26
26
  const success = withLogLevelsRestriction(["verbose", "info"], (message) => log(chalk.green(message)));
27
+ // eslint-disable-next-line no-console
27
28
  const log = (message) => console.log(message);
28
29
  export const alerts = { error, warn, notice, info, success };
@@ -12,7 +12,7 @@ export const generate = async (pattern, options) => {
12
12
  if (files.length === 0) {
13
13
  return;
14
14
  }
15
- alerts.success(`Found ${files.length} file${files.length === 1 ? `` : `s`}. Generating type definitions...`);
15
+ alerts.success(`Found ${files.length} file${files.length === 1 ? "" : "s"}. Generating type definitions...`);
16
16
  // Wait for all the type definitions to be written.
17
17
  await Promise.all(files.map((file) => writeFile(file, options)));
18
18
  };
@@ -10,7 +10,7 @@ import { alerts } from "./alerts.js";
10
10
  export function listFilesAndPerformSanityChecks(pattern, options) {
11
11
  // Find all the files that match the provided pattern.
12
12
  const files = globSync(pattern, { ignore: options.ignore });
13
- if (!files || !files.length) {
13
+ if (!files?.length) {
14
14
  alerts.error("No files found.");
15
15
  }
16
16
  // This case still works as expected but it's easy to do on accident so
@@ -1,5 +1,7 @@
1
- import sass, { AsyncCompiler as SassAsyncCompiler, Compiler as SassCompiler } from "sass";
2
- import sassEmbedded, { AsyncCompiler as SassEmbeddedAsyncCompiler, Compiler as SassEmbeddedCompiler } from "sass-embedded";
1
+ import { type AsyncCompiler as SassAsyncCompiler, type Compiler as SassCompiler } from "sass";
2
+ import type * as sass from "sass";
3
+ import { type AsyncCompiler as SassEmbeddedAsyncCompiler, type Compiler as SassEmbeddedCompiler } from "sass-embedded";
4
+ import type * as sassEmbedded from "sass-embedded";
3
5
  /**
4
6
  * @public
5
7
  * A list of all possible SASS package implementations that can be used to
@@ -1,5 +1,5 @@
1
- import sass, { AsyncCompiler as SassAsyncCompiler, Compiler as SassCompiler } from "sass";
2
- import sassEmbedded, { AsyncCompiler as SassEmbeddedAsyncCompiler, Compiler as SassEmbeddedCompiler, } from "sass-embedded";
1
+ import {} from "sass";
2
+ import {} from "sass-embedded";
3
3
  /**
4
4
  * @public
5
5
  * A list of all possible SASS package implementations that can be used to
@@ -17,11 +17,21 @@ export const IMPLEMENTATIONS = ["sass", "sass-embedded"];
17
17
  export const getDefaultImplementation = (resolver) => {
18
18
  let pkg = "sass";
19
19
  try {
20
- resolver ? resolver("sass") : import("sass");
20
+ if (resolver) {
21
+ resolver("sass");
22
+ }
23
+ else {
24
+ void import("sass");
25
+ }
21
26
  }
22
27
  catch {
23
28
  try {
24
- resolver ? resolver("sass-embedded") : import("sass-embedded");
29
+ if (resolver) {
30
+ resolver("sass-embedded");
31
+ }
32
+ else {
33
+ void import("sass-embedded");
34
+ }
25
35
  pkg = "sass-embedded";
26
36
  }
27
37
  catch {
@@ -35,14 +45,10 @@ export const getDefaultImplementation = (resolver) => {
35
45
  *
36
46
  * @param implementation the desired implementation.
37
47
  */
38
- export const getImplementation = async (
39
- // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
40
- implementation = "sass") => {
48
+ export const getImplementation = async (implementation = "sass") => {
41
49
  return getImplementationAsync(implementation);
42
50
  };
43
- export const getImplementationAsync = (
44
- // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
45
- implementation = "sass") => {
51
+ export const getImplementationAsync = (implementation = "sass") => {
46
52
  if (implementation === "sass") {
47
53
  return import("sass");
48
54
  }
package/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export {} from "./typescript/class-names-to-type-definition.js";
2
2
  export { LOG_LEVELS } from "./core/alerts.js";
3
3
  export { IMPLEMENTATIONS } from "./implementations/implementations.js";
4
+ // eslint-disable-next-line no-restricted-exports
4
5
  export { main as default } from "./main.js";
package/esm/main.js CHANGED
@@ -27,7 +27,6 @@ export const main = async (pattern, cliOptions) => {
27
27
  options.loadPaths = [pattern];
28
28
  }
29
29
  // When the pattern provide is a directory, assume all .scss files within.
30
- // eslint-disable-next-line no-param-reassign
31
30
  pattern = slash(path.resolve(pattern, "**/*.scss"));
32
31
  }
33
32
  if (options.listDifferent) {
@@ -30,8 +30,8 @@ export const fileToClassNames = async (file, { style = "expanded", loadPaths = [
30
30
  else {
31
31
  nameFormats = [nameFormatDefault];
32
32
  }
33
- const result = !async
34
- ? getSyncCompiler({ implementation, root }).compile(file, {
33
+ const result = async
34
+ ? await (await getAsyncCompiler({ implementation, root })).compileAsync(file, {
35
35
  style,
36
36
  silenceDeprecations, // Suppress specified deprecations
37
37
  importers: customImporters({
@@ -41,7 +41,7 @@ export const fileToClassNames = async (file, { style = "expanded", loadPaths = [
41
41
  }),
42
42
  loadPaths: loadPaths,
43
43
  })
44
- : await (await getAsyncCompiler({ implementation, root })).compileAsync(file, {
44
+ : getSyncCompiler({ implementation, root }).compile(file, {
45
45
  style,
46
46
  silenceDeprecations, // Suppress specified deprecations
47
47
  importers: customImporters({
@@ -15,15 +15,15 @@ export type { AsyncImporter as SASSAsyncImporter, Importer as SASSImporter };
15
15
  export interface Aliases {
16
16
  [index: string]: string;
17
17
  }
18
- interface AliasImporterOptions {
18
+ interface IAliasImporterOptions {
19
19
  aliases: Aliases;
20
20
  aliasPrefixes: Aliases;
21
21
  }
22
22
  /**
23
23
  * Construct a SASS importer to create aliases for imports.
24
24
  */
25
- export declare const aliasResolver: ({ aliases, aliasPrefixes }: AliasImporterOptions) => (url: string) => string | null;
26
- export declare const aliasImporter: <TSync extends SyncMode = "sync">({ aliases, aliasPrefixes, }: AliasImporterOptions) => FileImporter<TSync>;
25
+ export declare const aliasResolver: ({ aliases, aliasPrefixes }: IAliasImporterOptions) => (url: string) => string | null;
26
+ export declare const aliasImporter: <TSync extends SyncMode = "sync">({ aliases, aliasPrefixes, }: IAliasImporterOptions) => FileImporter<TSync>;
27
27
  /**
28
28
  * @public
29
29
  */
@@ -9,7 +9,7 @@ export declare const EXPORT_TYPES: ExportType[];
9
9
  */
10
10
  export type QuoteType = "single" | "double";
11
11
  export declare const QUOTE_TYPES: QuoteType[];
12
- export interface TypeDefinitionOptions {
12
+ export interface ITypeDefinitionOptions {
13
13
  banner: string;
14
14
  classNames: ClassName[];
15
15
  file: string;
@@ -23,4 +23,4 @@ export declare const exportTypeNameDefault: string;
23
23
  export declare const exportTypeInterfaceDefault: string;
24
24
  export declare const quoteTypeDefault: QuoteType;
25
25
  export declare const bannerTypeDefault: string;
26
- export declare const classNamesToTypeDefinitions: (options: TypeDefinitionOptions) => string | null;
26
+ export declare const classNamesToTypeDefinitions: (options: ITypeDefinitionOptions) => string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@najemi-software/typed-scss-modules",
3
- "version": "13.8.0",
3
+ "version": "13.9.0",
4
4
  "private": false,
5
5
  "description": "TypeScript type definition generator for SCSS CSS Modules",
6
6
  "keywords": [
@@ -56,8 +56,8 @@
56
56
  "clean": "rm -rf ./esm",
57
57
  "format": "oxfmt --check",
58
58
  "format-fix": "oxfmt",
59
- "lint": "eslint .",
60
- "lint-fix": "eslint . --fix",
59
+ "lint": "oxlint . && eslint .",
60
+ "lint-fix": "oxlint . --fix && eslint . --fix",
61
61
  "prepare": "npm run build && husky",
62
62
  "test": "vitest",
63
63
  "test-once": "vitest run --silent",
@@ -79,18 +79,32 @@
79
79
  "yargs": "^17.7.2"
80
80
  },
81
81
  "devDependencies": {
82
+ "@eslint/js": "9.28.0",
83
+ "@gooddata/eslint-config": "^11.46.0",
84
+ "@gooddata/oxlint-config": "^11.46.0",
82
85
  "@microsoft/api-extractor": "^7.55.2",
83
- "@tsjam/eslint-config-recommended": "^0.2.4",
84
86
  "@types/node": "^22.19.3",
85
87
  "@types/reserved-words": "^0.1.0",
86
88
  "@types/yargs": "^17.0.35",
89
+ "@typescript-eslint/eslint-plugin": "8.58.0",
90
+ "@typescript-eslint/parser": "8.58.0",
87
91
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
88
- "@vitest/eslint-plugin": "^1.6.23",
89
- "eslint": "^9.34.0",
92
+ "@vitest/eslint-plugin": "1.6.6",
93
+ "eslint": "^9.39.2",
94
+ "eslint-plugin-headers": "1.3.3",
95
+ "eslint-plugin-import-esm": "1.2.1",
96
+ "eslint-plugin-jsdoc": "62.1.0",
97
+ "eslint-plugin-no-barrel-files": "1.2.2",
98
+ "eslint-plugin-no-only-tests": "3.3.0",
99
+ "eslint-plugin-sonarjs": "3.0.6",
100
+ "globals": "17.2.0",
90
101
  "husky": "^9.1.7",
102
+ "jiti": "2.6.1",
91
103
  "lint-staged": "^16.2.7",
92
104
  "npm-run-all": "^4.1.5",
93
105
  "oxfmt": "^0.52.0",
106
+ "oxlint": "1.51.0",
107
+ "oxlint-tsgolint": "0.15.0",
94
108
  "sass": "^1.97.1",
95
109
  "sass-embedded": "^1.97.1",
96
110
  "ts-node": "^10.9.2",