lint-suite 2.0.1 → 2.1.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/README.md +27 -7
- package/eslint.js +221 -85
- package/eslint.js.map +4 -4
- package/lib/rules/file-cache.d.ts +1 -1
- package/lib/rules/file-cache.d.ts.map +1 -1
- package/lib/rules/no-unstyled-classes/styles/stylesheet-classes.d.ts.map +1 -1
- package/lib/rules/no-unstyled-classes/styles/stylesheet-collection.d.ts +1 -1
- package/lib/rules/no-unstyled-classes/styles/stylesheet-collection.d.ts.map +1 -1
- package/lib/rules/no-unstyled-classes/styles/stylesheet-imports.d.ts +8 -1
- package/lib/rules/no-unstyled-classes/styles/stylesheet-imports.d.ts.map +1 -1
- package/lib/rules/no-unused-angular-instance-fields/project-usage/angular/angular-template-reads.d.ts.map +1 -1
- package/lib/rules/no-unused-angular-instance-fields/project-usage/common/project-index.type.d.ts +1 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/common/project-index.type.d.ts.map +1 -1
- package/lib/rules/no-unused-angular-instance-fields/project-usage/project-file-entry.d.ts.map +1 -1
- package/lib/rules/no-unused-angular-instance-fields/project-usage/project-index-reconciliation.d.ts.map +1 -1
- package/lib/rules/no-unused-angular-instance-fields/project-usage/typescript/typescript-dangling-imports.d.ts +8 -0
- package/lib/rules/no-unused-angular-instance-fields/project-usage/typescript/typescript-dangling-imports.d.ts.map +1 -0
- package/lib/rules/no-unused-classes/no-unused-classes.d.ts.map +1 -1
- package/lib/rules/no-unused-classes/template/template-usage.d.ts.map +1 -1
- package/lib/rules/no-unused-exports/common/no-unused-exports.type.d.ts +9 -1
- package/lib/rules/no-unused-exports/common/no-unused-exports.type.d.ts.map +1 -1
- package/lib/rules/no-unused-exports/disk-resolver.d.ts +9 -0
- package/lib/rules/no-unused-exports/disk-resolver.d.ts.map +1 -0
- package/lib/rules/no-unused-exports/export-index.d.ts.map +1 -1
- package/lib/rules/no-unused-exports/utils/module-edges.util.d.ts +3 -3
- package/lib/rules/no-unused-exports/utils/module-edges.util.d.ts.map +1 -1
- package/lib/rules/no-unused-exports/utils/module-resolver.util.d.ts +8 -0
- package/lib/rules/no-unused-exports/utils/module-resolver.util.d.ts.map +1 -0
- package/lib/rules/package-version.d.ts +2 -0
- package/lib/rules/package-version.d.ts.map +1 -0
- package/lib/rules/utils/template-classes.util.d.ts +2 -0
- package/lib/rules/utils/template-classes.util.d.ts.map +1 -1
- package/lib/typescript-safety.d.ts.map +1 -1
- package/package.json +4 -7
- package/stylelint.js +96 -28
- package/stylelint.js.map +4 -4
- package/eslint.cjs +0 -7363
- package/eslint.cjs.map +0 -7
- package/lib/rules/no-unused-exports/utils/module-target.util.d.ts +0 -4
- package/lib/rules/no-unused-exports/utils/module-target.util.d.ts.map +0 -1
- package/prettier.cjs +0 -50
- package/prettier.cjs.map +0 -7
- package/stylelint.cjs +0 -947
- package/stylelint.cjs.map +0 -7
|
@@ -3,7 +3,7 @@ type FileParser<T> = (text: string, path: string) => T;
|
|
|
3
3
|
/** Writes every cache that parsed something this run; runs at process exit. */
|
|
4
4
|
export declare const flushFileCaches: () => void;
|
|
5
5
|
/**
|
|
6
|
-
* A cache of parsed files keyed by path and mtime, mirrored to
|
|
6
|
+
* A cache of parsed files keyed by path, installed package version and mtime, mirrored to
|
|
7
7
|
* `node_modules/.cache/lint-suite/<name>.v<format>.json` (or
|
|
8
8
|
* `LINT_SUITE_CACHE_DIR`; `LINT_SUITE_CACHE=0` disables the disk copy).
|
|
9
9
|
* Values must survive JSON.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-cache.d.ts","sourceRoot":"","sources":["../../../../../../packages/lint-suite/src/lib/rules/file-cache.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"file-cache.d.ts","sourceRoot":"","sources":["../../../../../../packages/lint-suite/src/lib/rules/file-cache.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAGzE,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC,CAAC;AAqFvD,+EAA+E;AAE/E,eAAO,MAAM,eAAe,QAAO,IAOlC,CAAC;AASF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,MAAM,MAAM,KAAG,SAAS,CAAC,CAAC,CAY5D,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,CAAC,EAC1B,OAAO,SAAS,CAAC,CAAC,CAAC,EACnB,MAAM,MAAM,EACZ,OAAO,UAAU,CAAC,CAAC,CAAC,KACnB,CAAC,GAAG,IAoBN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stylesheet-classes.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/lint-suite/src/lib/rules/no-unstyled-classes/styles/stylesheet-classes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stylesheet-classes.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/lint-suite/src/lib/rules/no-unstyled-classes/styles/stylesheet-classes.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,iBAAiB,EAEjB,gBAAgB,EACjB,MAAM,uCAAuC,CAAC;AA8H/C,eAAO,MAAM,iBAAiB,GAC5B,SAAS,gBAAgB,EAAE,KAC1B,iBAiBF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Root } from 'postcss';
|
|
2
2
|
import type { StylesheetEntry } from '../common/no-unstyled-classes.type.ts';
|
|
3
|
-
export declare const collectStylesheet: (root: Root
|
|
3
|
+
export declare const collectStylesheet: (root: Root) => StylesheetEntry;
|
|
4
4
|
//# sourceMappingURL=stylesheet-collection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stylesheet-collection.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/lint-suite/src/lib/rules/no-unstyled-classes/styles/stylesheet-collection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,IAAI,EAAQ,MAAM,SAAS,CAAC;AAKlD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"stylesheet-collection.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/lint-suite/src/lib/rules/no-unstyled-classes/styles/stylesheet-collection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,IAAI,EAAQ,MAAM,SAAS,CAAC;AAKlD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAuB7E,eAAO,MAAM,iBAAiB,GAAI,MAAM,IAAI,KAAG,eAa9C,CAAC"}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/** The specifier of a `@use`, `@import`, or `@forward` that may name a file. */
|
|
2
|
+
export declare const importSpecifier: (params: string) => string | null;
|
|
3
|
+
/**
|
|
4
|
+
* The file a specifier names right now. Resolved on every read, never with
|
|
5
|
+
* the parse: a partial created after the `@use` was written must show up
|
|
6
|
+
* without the importer changing.
|
|
7
|
+
*/
|
|
8
|
+
export declare const resolveStylesheetImport: (specifier: string, directory: string) => string | null;
|
|
2
9
|
//# sourceMappingURL=stylesheet-imports.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stylesheet-imports.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/lint-suite/src/lib/rules/no-unstyled-classes/styles/stylesheet-imports.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stylesheet-imports.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/lint-suite/src/lib/rules/no-unstyled-classes/styles/stylesheet-imports.ts"],"names":[],"mappings":"AA4BA,gFAAgF;AAChF,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,IAUzD,CAAC;AAiBF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAClC,WAAW,MAAM,EACjB,WAAW,MAAM,KAChB,MAAM,GAAG,IAMX,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-template-reads.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/lint-suite/src/lib/rules/no-unused-angular-instance-fields/project-usage/angular/angular-template-reads.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAGV,2BAA2B,EAE5B,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"angular-template-reads.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/lint-suite/src/lib/rules/no-unused-angular-instance-fields/project-usage/angular/angular-template-reads.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAGV,2BAA2B,EAE5B,MAAM,iCAAiC,CAAC;AAqEzC,eAAO,MAAM,qBAAqB,GAChC,SAAS,mBAAmB,KAC3B,OAQF,CAAC;AAmDF,0EAA0E;AAC1E,eAAO,MAAM,2BAA2B,GAAI,kDAMzC,2BAA2B,KAAG,aAkChC,CAAC"}
|
package/lib/rules/no-unused-angular-instance-fields/project-usage/common/project-index.type.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export type TemplateReads = {
|
|
|
20
20
|
* objects is still the one the current Program holds.
|
|
21
21
|
*/
|
|
22
22
|
export type FileEntry = {
|
|
23
|
+
readonly dangling: boolean;
|
|
23
24
|
readonly declarations: ReadonlySet<Node>;
|
|
24
25
|
readonly dependencies: ReadonlySet<SourceFile>;
|
|
25
26
|
readonly fallbackNames: ReadonlySet<string>;
|
package/lib/rules/no-unused-angular-instance-fields/project-usage/common/project-index.type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-index.type.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/lint-suite/src/lib/rules/no-unused-angular-instance-fields/project-usage/common/project-index.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzE,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE5E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,mBAAmB,EAAE,CAAC;IACjD,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;CACtC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IACzC,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IAC/C,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC5C,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7C,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,gBAAgB,EAAE,mBAAmB,EAAE,CAAC;IACjD,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7C,QAAQ,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC;IACjC,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;AAEzD,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC3C,QAAQ,CAAC,iBAAiB,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9C,UAAU,EAAE,cAAc,CAAC;IAE3B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACzC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAExB,qBAAqB,EAAE,MAAM,CAAC;IAE9B,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"project-index.type.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/lint-suite/src/lib/rules/no-unused-angular-instance-fields/project-usage/common/project-index.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzE,OAAO,KAAK,EA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IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;AAEzD,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC3C,QAAQ,CAAC,iBAAiB,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9C,UAAU,EAAE,cAAc,CAAC;IAE3B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACzC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAExB,qBAAqB,EAAE,MAAM,CAAC;IAE9B,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC"}
|
package/lib/rules/no-unused-angular-instance-fields/project-usage/project-file-entry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-file-entry.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/lint-suite/src/lib/rules/no-unused-angular-instance-fields/project-usage/project-file-entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,UAAU,EAAQ,WAAW,EAAE,MAAM,YAAY,CAAC;AAGtE,OAAO,KAAK,EACV,SAAS,EACT,YAAY,EAEb,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"project-file-entry.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/lint-suite/src/lib/rules/no-unused-angular-instance-fields/project-usage/project-file-entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,UAAU,EAAQ,WAAW,EAAE,MAAM,YAAY,CAAC;AAGtE,OAAO,KAAK,EACV,SAAS,EACT,YAAY,EAEb,MAAM,gCAAgC,CAAC;AAiExC,eAAO,MAAM,YAAY,GACvB,OAAO,YAAY,EACnB,YAAY,UAAU,EACtB,SAAS,WAAW,KACnB,SAyCF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-index-reconciliation.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/lint-suite/src/lib/rules/no-unused-angular-instance-fields/project-usage/project-index-reconciliation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAA2B,MAAM,YAAY,CAAC;AAEnE,OAAO,KAAK,EAGV,YAAY,EAEb,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"project-index-reconciliation.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/lint-suite/src/lib/rules/no-unused-angular-instance-fields/project-usage/project-index-reconciliation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAA2B,MAAM,YAAY,CAAC;AAEnE,OAAO,KAAK,EAGV,YAAY,EAEb,MAAM,gCAAgC,CAAC;AAsHxC,eAAO,MAAM,SAAS,GACpB,OAAO,YAAY,EACnB,SAAS,OAAO,EAChB,UAAU,MAAM,KACf,IAWF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SourceFile, TypeChecker } from 'typescript';
|
|
2
|
+
/**
|
|
3
|
+
* True when a binding import resolves to no module: its file may not exist
|
|
4
|
+
* yet, or may still be empty. Reads through it cannot be typed, and the
|
|
5
|
+
* checker of an editor session never retries a resolution that failed.
|
|
6
|
+
*/
|
|
7
|
+
export declare const hasDanglingImport: (sourceFile: SourceFile, checker: TypeChecker) => boolean;
|
|
8
|
+
//# sourceMappingURL=typescript-dangling-imports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript-dangling-imports.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/lint-suite/src/lib/rules/no-unused-angular-instance-fields/project-usage/typescript/typescript-dangling-imports.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,YAAY,UAAU,EACtB,SAAS,WAAW,KACnB,OAYF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-unused-classes.d.ts","sourceRoot":"","sources":["../../../../../../../packages/lint-suite/src/lib/rules/no-unused-classes/no-unused-classes.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAoC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"no-unused-classes.d.ts","sourceRoot":"","sources":["../../../../../../../packages/lint-suite/src/lib/rules/no-unused-classes/no-unused-classes.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAoC,MAAM,WAAW,CAAC;AAyB1E,eAAO,MAAM,QAAQ,iCAAiC,CAAC;AAOvD,eAAO,MAAM,QAAQ;qBALG,MAAM,KAAG,MAAM;CAK2B,CAAC;AAqKnE,QAAA,MAAM,MAAM,EAAE,MAAgD,CAAC;AAE/D,eAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-usage.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/lint-suite/src/lib/rules/no-unused-classes/template/template-usage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"template-usage.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/lint-suite/src/lib/rules/no-unused-classes/template/template-usage.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACd,MAAM,qCAAqC,CAAC;AA+G7C,eAAO,MAAM,aAAa,GAAI,SAAS,cAAc,EAAE,KAAG,aAuBzD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
-
import type { Expression, SourceFile } from 'typescript';
|
|
2
|
+
import type { Expression, SourceFile, StringLiteralLike, TypeChecker } from 'typescript';
|
|
3
3
|
export type MessageIds = 'unusedExport' | 'unusedModule';
|
|
4
4
|
export type RuleOptions = {
|
|
5
5
|
readonly entryPoints: string[];
|
|
@@ -22,6 +22,7 @@ export type FileEdges = {
|
|
|
22
22
|
readonly imports: ImportEdge[];
|
|
23
23
|
readonly reExports: ReExportEdge[];
|
|
24
24
|
readonly starTargets: string[];
|
|
25
|
+
readonly dangling: string[];
|
|
25
26
|
readonly skipped: boolean;
|
|
26
27
|
};
|
|
27
28
|
export type EdgeAccumulator = {
|
|
@@ -30,6 +31,7 @@ export type EdgeAccumulator = {
|
|
|
30
31
|
readonly imports: ImportEdge[];
|
|
31
32
|
readonly reExports: ReExportEdge[];
|
|
32
33
|
readonly starTargets: string[];
|
|
34
|
+
readonly dangling: string[];
|
|
33
35
|
};
|
|
34
36
|
export type ModuleResolver = (specifier: Expression | undefined) => string | undefined;
|
|
35
37
|
export type ExportUsage = Map<string, Map<string, number>>;
|
|
@@ -67,4 +69,10 @@ export type Aggregate = {
|
|
|
67
69
|
readonly starTouched: Map<string, number>;
|
|
68
70
|
};
|
|
69
71
|
export type IsExternalFile = (sourceFile: SourceFile) => boolean;
|
|
72
|
+
export type DiskResolver = (specifier: StringLiteralLike) => SourceFile | undefined;
|
|
73
|
+
export type ModuleResolution = {
|
|
74
|
+
readonly checker: TypeChecker;
|
|
75
|
+
readonly isExternal: IsExternalFile;
|
|
76
|
+
readonly onDisk: DiskResolver;
|
|
77
|
+
};
|
|
70
78
|
//# sourceMappingURL=no-unused-exports.type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-unused-exports.type.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/lint-suite/src/lib/rules/no-unused-exports/common/no-unused-exports.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"no-unused-exports.type.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/lint-suite/src/lib/rules/no-unused-exports/common/no-unused-exports.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,WAAW,EACZ,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,cAAc,CAAC;AAEzD,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE7D,MAAM,MAAM,OAAO,GAAG,CAAC,WAAW,CAAC,CAAC;AAEpC,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAEpE,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;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zB,UAAU,GAAG,SAAS,CAAC;AAE5B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;CAC/B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Program } from 'typescript';
|
|
2
|
+
import type { DiskResolver } from './common/no-unused-exports.type.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves a specifier the checker could not against the disk as it is now.
|
|
5
|
+
* An editor's project service never retries a failed resolution, so a file
|
|
6
|
+
* created after its import was written stays unknown to the checker.
|
|
7
|
+
*/
|
|
8
|
+
export declare const diskResolver: (program: Program) => DiskResolver;
|
|
9
|
+
//# sourceMappingURL=disk-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disk-resolver.d.ts","sourceRoot":"","sources":["../../../../../../../packages/lint-suite/src/lib/rules/no-unused-exports/disk-resolver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,OAAO,KAAG,YAgB/C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/lint-suite/src/lib/rules/no-unused-exports/export-index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"export-index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/lint-suite/src/lib/rules/no-unused-exports/export-index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAc,MAAM,YAAY,CAAC;AAEtD,OAAO,KAAK,EACV,SAAS,EAIT,aAAa,EAEd,MAAM,oCAAoC,CAAC;AAS5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAmFlE,eAAO,MAAM,WAAW,GAAI,SAAS,OAAO,KAAG,SAa9C,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,WAAW,SAAS,EACpB,SAAS,WAAW,KACnB,aAoBF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SourceFile
|
|
2
|
-
import type { FileEdges,
|
|
3
|
-
export declare const moduleEdges: (sourceFile: SourceFile,
|
|
1
|
+
import type { SourceFile } from 'typescript';
|
|
2
|
+
import type { FileEdges, ModuleResolution } from '../common/no-unused-exports.type.ts';
|
|
3
|
+
export declare const moduleEdges: (sourceFile: SourceFile, resolution: ModuleResolution) => FileEdges;
|
|
4
4
|
//# sourceMappingURL=module-edges.util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-edges.util.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/lint-suite/src/lib/rules/no-unused-exports/utils/module-edges.util.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAIV,UAAU,
|
|
1
|
+
{"version":3,"file":"module-edges.util.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/lint-suite/src/lib/rules/no-unused-exports/utils/module-edges.util.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAIV,UAAU,EAEX,MAAM,YAAY,CAAC;AAKpB,OAAO,KAAK,EAEV,SAAS,EAET,gBAAgB,EAEjB,MAAM,qCAAqC,CAAC;AAwH7C,eAAO,MAAM,WAAW,GACtB,YAAY,UAAU,EACtB,YAAY,gBAAgB,KAC3B,SA8BF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ModuleResolution, ModuleResolver } from '../common/no-unused-exports.type.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves a specifier to the project file it names: through the checker
|
|
4
|
+
* first, then the disk when the checker knows nothing. A literal specifier
|
|
5
|
+
* found nowhere is listed in `dangling`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const moduleResolver: (resolution: ModuleResolution, dangling: string[]) => ModuleResolver;
|
|
8
|
+
//# sourceMappingURL=module-resolver.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-resolver.util.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/lint-suite/src/lib/rules/no-unused-exports/utils/module-resolver.util.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,gBAAgB,EAChB,cAAc,EACf,MAAM,qCAAqC,CAAC;AAqC7C;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,YAAY,gBAAgB,EAC5B,UAAU,MAAM,EAAE,KACjB,cAoBF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-version.d.ts","sourceRoot":"","sources":["../../../../../../packages/lint-suite/src/lib/rules/package-version.ts"],"names":[],"mappings":"AAwEA,eAAO,MAAM,eAAe,QAAmB,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { TmplAstBoundAttribute } from '@angular/compiler';
|
|
1
2
|
import type { ClassAttributeHost, TemplateClass } from '../common/class-usage.type.ts';
|
|
3
|
+
export declare const isClassExpression: (input: TmplAstBoundAttribute) => boolean;
|
|
2
4
|
export declare const templateClasses: (node: ClassAttributeHost) => TemplateClass[];
|
|
3
5
|
//# sourceMappingURL=template-classes.util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-classes.util.d.ts","sourceRoot":"","sources":["../../../../../../../packages/lint-suite/src/lib/rules/utils/template-classes.util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"template-classes.util.d.ts","sourceRoot":"","sources":["../../../../../../../packages/lint-suite/src/lib/rules/utils/template-classes.util.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EAEtB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EACV,kBAAkB,EAClB,aAAa,EACd,MAAM,+BAA+B,CAAC;AAiDvC,eAAO,MAAM,iBAAiB,GAAI,OAAO,qBAAqB,KAAG,OAUhE,CAAC;AAiCF,eAAO,MAAM,eAAe,GAAI,MAAM,kBAAkB,KAAG,aAAa,EAoBvE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-safety.d.ts","sourceRoot":"","sources":["../../../../../packages/lint-suite/src/lib/typescript-safety.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"typescript-safety.d.ts","sourceRoot":"","sources":["../../../../../packages/lint-suite/src/lib/typescript-safety.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,wCAgK3B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lint-suite",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Reusable ESLint, Stylelint, and Prettier configurations",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -61,18 +61,15 @@
|
|
|
61
61
|
"./package.json": "./package.json",
|
|
62
62
|
"./eslint": {
|
|
63
63
|
"types": "./eslint.d.ts",
|
|
64
|
-
"
|
|
65
|
-
"require": "./eslint.cjs"
|
|
64
|
+
"default": "./eslint.js"
|
|
66
65
|
},
|
|
67
66
|
"./stylelint": {
|
|
68
67
|
"types": "./stylelint.d.ts",
|
|
69
|
-
"
|
|
70
|
-
"require": "./stylelint.cjs"
|
|
68
|
+
"default": "./stylelint.js"
|
|
71
69
|
},
|
|
72
70
|
"./prettier": {
|
|
73
71
|
"types": "./prettier.d.ts",
|
|
74
|
-
"
|
|
75
|
-
"require": "./prettier.cjs"
|
|
72
|
+
"default": "./prettier.js"
|
|
76
73
|
}
|
|
77
74
|
},
|
|
78
75
|
"files": [
|
package/stylelint.js
CHANGED
|
@@ -6,22 +6,69 @@ import bemPattern from "stylelint-selector-bem-pattern";
|
|
|
6
6
|
import stylelint from "stylelint";
|
|
7
7
|
|
|
8
8
|
// packages/lint-suite/src/lib/rules/no-unused-classes/styles/stylesheet-components.ts
|
|
9
|
-
import { existsSync, readdirSync as readdirSync2, statSync as statSync2 } from "node:fs";
|
|
10
|
-
import { dirname as
|
|
9
|
+
import { existsSync as existsSync2, readdirSync as readdirSync2, statSync as statSync2 } from "node:fs";
|
|
10
|
+
import { dirname as dirname4, join as join4, resolve as resolve2 } from "node:path";
|
|
11
11
|
|
|
12
12
|
// packages/lint-suite/src/lib/rules/no-unused-classes/styles/linked-templates.ts
|
|
13
13
|
import { readdirSync } from "node:fs";
|
|
14
|
-
import { dirname as
|
|
14
|
+
import { dirname as dirname3, join as join3, resolve } from "node:path";
|
|
15
15
|
|
|
16
16
|
// packages/lint-suite/src/lib/rules/file-cache.ts
|
|
17
17
|
import {
|
|
18
18
|
mkdirSync,
|
|
19
|
-
readFileSync,
|
|
19
|
+
readFileSync as readFileSync2,
|
|
20
20
|
renameSync,
|
|
21
21
|
statSync,
|
|
22
22
|
writeFileSync
|
|
23
23
|
} from "node:fs";
|
|
24
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
25
|
+
|
|
26
|
+
// packages/lint-suite/src/lib/rules/package-version.ts
|
|
27
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
24
28
|
import { dirname, join } from "node:path";
|
|
29
|
+
import { fileURLToPath } from "node:url";
|
|
30
|
+
var PACKAGE_NAME = "lint-suite";
|
|
31
|
+
var DEV_VERSION = "dev";
|
|
32
|
+
var MAX_MANIFEST_DEPTH = 6;
|
|
33
|
+
var moduleDirectory = () => {
|
|
34
|
+
const url = import.meta.url;
|
|
35
|
+
if (typeof url !== "string") return null;
|
|
36
|
+
return dirname(fileURLToPath(url));
|
|
37
|
+
};
|
|
38
|
+
var manifestVersion = (file) => {
|
|
39
|
+
const isPresent = existsSync(file);
|
|
40
|
+
if (!isPresent) return null;
|
|
41
|
+
try {
|
|
42
|
+
const manifest = JSON.parse(readFileSync(file, "utf8"));
|
|
43
|
+
const isRecord = typeof manifest === "object" && manifest !== null;
|
|
44
|
+
if (!isRecord) return null;
|
|
45
|
+
if (!("name" in manifest)) return null;
|
|
46
|
+
if (manifest.name !== PACKAGE_NAME) return null;
|
|
47
|
+
if (!("version" in manifest)) return null;
|
|
48
|
+
if (typeof manifest.version !== "string") return null;
|
|
49
|
+
return manifest.version;
|
|
50
|
+
} catch {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var parentOf = (directory) => {
|
|
55
|
+
const parent = dirname(directory);
|
|
56
|
+
if (parent === directory) return null;
|
|
57
|
+
return parent;
|
|
58
|
+
};
|
|
59
|
+
var packageVersion = () => {
|
|
60
|
+
let directory = moduleDirectory();
|
|
61
|
+
for (let depth = 0; depth < MAX_MANIFEST_DEPTH; depth += 1) {
|
|
62
|
+
if (directory === null) break;
|
|
63
|
+
const version = manifestVersion(join(directory, "package.json"));
|
|
64
|
+
if (version !== null) return version;
|
|
65
|
+
directory = parentOf(directory);
|
|
66
|
+
}
|
|
67
|
+
return DEV_VERSION;
|
|
68
|
+
};
|
|
69
|
+
var PACKAGE_VERSION = packageVersion();
|
|
70
|
+
|
|
71
|
+
// packages/lint-suite/src/lib/rules/file-cache.ts
|
|
25
72
|
var CACHE_FORMAT_VERSION = 1;
|
|
26
73
|
var caches = /* @__PURE__ */ new Set();
|
|
27
74
|
var isFlushRegistered = false;
|
|
@@ -30,12 +77,12 @@ var cacheDirectory = () => {
|
|
|
30
77
|
const isDisabled = LINT_SUITE_CACHE === "0";
|
|
31
78
|
if (isDisabled) return null;
|
|
32
79
|
if (LINT_SUITE_CACHE_DIR) return LINT_SUITE_CACHE_DIR;
|
|
33
|
-
return
|
|
80
|
+
return join2(process.cwd(), "node_modules", ".cache", "lint-suite");
|
|
34
81
|
};
|
|
35
82
|
var cacheFile = (name) => {
|
|
36
83
|
const directory = cacheDirectory();
|
|
37
84
|
if (directory === null) return null;
|
|
38
|
-
return
|
|
85
|
+
return join2(directory, `${name}.v${CACHE_FORMAT_VERSION}.json`);
|
|
39
86
|
};
|
|
40
87
|
var isCachedFile = (value) => {
|
|
41
88
|
const isObject = typeof value === "object" && value !== null;
|
|
@@ -58,7 +105,7 @@ var load = (cache2) => {
|
|
|
58
105
|
const file = cacheFile(cache2.name);
|
|
59
106
|
if (file === null) return;
|
|
60
107
|
try {
|
|
61
|
-
const stored = storedEntries(
|
|
108
|
+
const stored = storedEntries(readFileSync2(file, "utf8"));
|
|
62
109
|
for (const [path, entry] of stored) cache2.entries.set(path, entry);
|
|
63
110
|
} catch {
|
|
64
111
|
return;
|
|
@@ -68,7 +115,7 @@ var write = (cache2) => {
|
|
|
68
115
|
const file = cacheFile(cache2.name);
|
|
69
116
|
if (file === null) return;
|
|
70
117
|
try {
|
|
71
|
-
mkdirSync(
|
|
118
|
+
mkdirSync(dirname2(file), { recursive: true });
|
|
72
119
|
const temporary = `${file}.${process.pid}.tmp`;
|
|
73
120
|
const stored = Object.fromEntries(cache2.entries);
|
|
74
121
|
writeFileSync(temporary, JSON.stringify(stored));
|
|
@@ -104,10 +151,10 @@ var readCached = (cache2, path, parse) => {
|
|
|
104
151
|
if (!cache2.loaded) load(cache2);
|
|
105
152
|
try {
|
|
106
153
|
const stats = statSync(path, { bigint: true });
|
|
107
|
-
const version = `${stats.mtimeNs}:${stats.size}`;
|
|
154
|
+
const version = `${PACKAGE_VERSION}:${stats.mtimeNs}:${stats.size}`;
|
|
108
155
|
const cached = cache2.entries.get(path);
|
|
109
156
|
if (cached?.version === version) return cached.value;
|
|
110
|
-
const value = parse(
|
|
157
|
+
const value = parse(readFileSync2(path, "utf8"), path);
|
|
111
158
|
const fresh = { value, version };
|
|
112
159
|
cache2.entries.set(path, fresh);
|
|
113
160
|
cache2.dirty = true;
|
|
@@ -155,7 +202,7 @@ var walkTemplates = (root) => {
|
|
|
155
202
|
const directory = pending.pop();
|
|
156
203
|
if (directory === void 0) break;
|
|
157
204
|
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
|
158
|
-
const path =
|
|
205
|
+
const path = join3(directory, entry.name);
|
|
159
206
|
const isDirectory = entry.isDirectory();
|
|
160
207
|
if (isDirectory) {
|
|
161
208
|
const canWalk = isWalkable(entry.name);
|
|
@@ -178,7 +225,7 @@ var templatesUnder = (root) => {
|
|
|
178
225
|
var templatesByStylesheet = (root) => {
|
|
179
226
|
const byStylesheet = /* @__PURE__ */ new Map();
|
|
180
227
|
for (const template of templatesUnder(root)) {
|
|
181
|
-
const directory =
|
|
228
|
+
const directory = dirname3(template);
|
|
182
229
|
for (const href of templateLinks(template)) {
|
|
183
230
|
const stylesheet = resolve(directory, href);
|
|
184
231
|
const linked = byStylesheet.get(stylesheet) ?? [];
|
|
@@ -325,7 +372,7 @@ var declaredStylesheets = (descriptor, directory) => {
|
|
|
325
372
|
var fileTemplate = (descriptor, directory) => {
|
|
326
373
|
if (descriptor.templateUrl === null) return null;
|
|
327
374
|
const path = resolve2(directory, descriptor.templateUrl);
|
|
328
|
-
const isPresent =
|
|
375
|
+
const isPresent = existsSync2(path);
|
|
329
376
|
if (!isPresent) return null;
|
|
330
377
|
const source = { kind: "file", path };
|
|
331
378
|
return source;
|
|
@@ -340,14 +387,14 @@ var inlineTemplate = (descriptor, componentPath) => {
|
|
|
340
387
|
return source;
|
|
341
388
|
};
|
|
342
389
|
var componentTemplate = (descriptor, componentPath) => {
|
|
343
|
-
const directory =
|
|
390
|
+
const directory = dirname4(componentPath);
|
|
344
391
|
const file = fileTemplate(descriptor, directory);
|
|
345
392
|
if (file !== null) return file;
|
|
346
393
|
const inline = inlineTemplate(descriptor, componentPath);
|
|
347
394
|
return inline ?? UNKNOWN_TEMPLATE;
|
|
348
395
|
};
|
|
349
396
|
var matchedTemplates = (componentPath, stylesheetPath) => {
|
|
350
|
-
const directory =
|
|
397
|
+
const directory = dirname4(componentPath);
|
|
351
398
|
const sources = [];
|
|
352
399
|
for (const descriptor of componentMetadata(componentPath)) {
|
|
353
400
|
const declared = declaredStylesheets(descriptor, directory);
|
|
@@ -367,7 +414,7 @@ var directoryFiles = (directory, extension) => {
|
|
|
367
414
|
var fallbackTemplates = (stylesheetPath) => {
|
|
368
415
|
const sibling = stylesheetPath.replace(STYLE_EXTENSION, ".html");
|
|
369
416
|
const paths = /* @__PURE__ */ new Set();
|
|
370
|
-
const hasSibling =
|
|
417
|
+
const hasSibling = existsSync2(sibling);
|
|
371
418
|
if (hasSibling) paths.add(sibling);
|
|
372
419
|
for (const path of linkedTemplates(stylesheetPath)) paths.add(path);
|
|
373
420
|
const toSource = (path) => {
|
|
@@ -379,10 +426,10 @@ var fallbackTemplates = (stylesheetPath) => {
|
|
|
379
426
|
};
|
|
380
427
|
var stylesheetTemplates = (stylesheetPath) => {
|
|
381
428
|
const resolved = resolve2(stylesheetPath);
|
|
382
|
-
const directory =
|
|
429
|
+
const directory = dirname4(resolved);
|
|
383
430
|
const sources = [];
|
|
384
431
|
for (const file of directoryFiles(directory, MODULE_EXTENSION)) {
|
|
385
|
-
const componentPath =
|
|
432
|
+
const componentPath = join4(directory, file);
|
|
386
433
|
const matched = matchedTemplates(componentPath, resolved);
|
|
387
434
|
sources.push(...matched);
|
|
388
435
|
}
|
|
@@ -630,7 +677,12 @@ var classExpressionUsage = (source) => {
|
|
|
630
677
|
|
|
631
678
|
// packages/lint-suite/src/lib/rules/utils/template-classes.util.ts
|
|
632
679
|
import { ParseSourceSpan as ParseSourceSpan2 } from "@angular/compiler";
|
|
633
|
-
var
|
|
680
|
+
var CLASS_ATTRIBUTES = [
|
|
681
|
+
"class",
|
|
682
|
+
"routerLinkActive",
|
|
683
|
+
"animate.enter",
|
|
684
|
+
"animate.leave"
|
|
685
|
+
];
|
|
634
686
|
var CLASS_BINDING_PREFIX = "class.";
|
|
635
687
|
var TOKEN = /\S+/gu;
|
|
636
688
|
var expressionSource = (value) => {
|
|
@@ -659,11 +711,11 @@ var boundClassName = (input) => {
|
|
|
659
711
|
return input.name;
|
|
660
712
|
};
|
|
661
713
|
var isClassExpression = (input) => {
|
|
662
|
-
const isClassName = input.name
|
|
714
|
+
const isClassName = CLASS_ATTRIBUTES.includes(input.name);
|
|
663
715
|
if (!isClassName) return false;
|
|
664
716
|
const { details } = input.keySpan;
|
|
665
717
|
if (details === null) return true;
|
|
666
|
-
return details ===
|
|
718
|
+
return details === input.name;
|
|
667
719
|
};
|
|
668
720
|
var expressionClasses = (input) => {
|
|
669
721
|
const source = expressionSource(input.value);
|
|
@@ -688,7 +740,7 @@ var inputClasses = (input) => {
|
|
|
688
740
|
var templateClasses = (node) => {
|
|
689
741
|
const classes = [];
|
|
690
742
|
for (const attribute of node.attributes) {
|
|
691
|
-
const isClassName = attribute.name
|
|
743
|
+
const isClassName = CLASS_ATTRIBUTES.includes(attribute.name);
|
|
692
744
|
if (isClassName) {
|
|
693
745
|
const found = staticClasses(attribute);
|
|
694
746
|
classes.push(...found);
|
|
@@ -705,7 +757,6 @@ var templateClasses = (node) => {
|
|
|
705
757
|
var toRegExp = (pattern) => new RegExp(pattern, "u");
|
|
706
758
|
|
|
707
759
|
// packages/lint-suite/src/lib/rules/no-unused-classes/template/template-usage.ts
|
|
708
|
-
var CLASS_ATTRIBUTE2 = "class";
|
|
709
760
|
var NG_CLASS_ATTRIBUTE = "ngClass";
|
|
710
761
|
var matchesNone = () => false;
|
|
711
762
|
var UNKNOWN_USAGE2 = {
|
|
@@ -722,11 +773,7 @@ var expressionSource2 = (value) => {
|
|
|
722
773
|
var isClassInput = (input) => {
|
|
723
774
|
const isNgClass = input.name === NG_CLASS_ATTRIBUTE;
|
|
724
775
|
if (isNgClass) return true;
|
|
725
|
-
|
|
726
|
-
if (!isClass) return false;
|
|
727
|
-
const { details } = input.keySpan;
|
|
728
|
-
if (details === null) return true;
|
|
729
|
-
return details === CLASS_ATTRIBUTE2;
|
|
776
|
+
return isClassExpression(input);
|
|
730
777
|
};
|
|
731
778
|
var ClassUsageVisitor = class extends TmplAstRecursiveVisitor {
|
|
732
779
|
names = /* @__PURE__ */ new Set();
|
|
@@ -844,6 +891,23 @@ var extendedClasses = (root) => {
|
|
|
844
891
|
root.walkAtRules("extend", collect2);
|
|
845
892
|
return names;
|
|
846
893
|
};
|
|
894
|
+
var isEmittingRule = (rule) => {
|
|
895
|
+
const isEmittingNode = (node) => {
|
|
896
|
+
return node.type === "decl" || node.type === "atrule";
|
|
897
|
+
};
|
|
898
|
+
const children = rule.nodes;
|
|
899
|
+
return children.some(isEmittingNode);
|
|
900
|
+
};
|
|
901
|
+
var emittedClasses = (root) => {
|
|
902
|
+
const names = /* @__PURE__ */ new Set();
|
|
903
|
+
const visit = (rule, resolved) => {
|
|
904
|
+
const isEmitting = isEmittingRule(rule);
|
|
905
|
+
if (!isEmitting) return;
|
|
906
|
+
for (const selector of resolved) addNames2(selector, names);
|
|
907
|
+
};
|
|
908
|
+
walkResolvedRules(root, visit);
|
|
909
|
+
return names;
|
|
910
|
+
};
|
|
847
911
|
var ruleClasses = (resolved, parents) => {
|
|
848
912
|
const inherited = /* @__PURE__ */ new Set();
|
|
849
913
|
for (const parent of parents) addNames2(parent, inherited);
|
|
@@ -858,6 +922,8 @@ var ruleClasses = (resolved, parents) => {
|
|
|
858
922
|
return [...own];
|
|
859
923
|
};
|
|
860
924
|
var reportUnused = (context, rule, name) => {
|
|
925
|
+
const isEmitted = context.emitted.has(name);
|
|
926
|
+
if (!isEmitted) return;
|
|
861
927
|
const matchesIgnored = (pattern) => pattern.test(name);
|
|
862
928
|
const isIgnored = context.ignored.some(matchesIgnored);
|
|
863
929
|
if (isIgnored) return;
|
|
@@ -889,10 +955,12 @@ var noUnusedClasses = (primary, secondary) => {
|
|
|
889
955
|
const patterns = secondary?.ignoreClassPatterns ?? DEFAULT_IGNORE_PATTERNS;
|
|
890
956
|
const ignored = patterns.map(toRegExp);
|
|
891
957
|
const extended = extendedClasses(root);
|
|
958
|
+
const emitted = emittedClasses(root);
|
|
892
959
|
const context = {
|
|
893
960
|
result,
|
|
894
961
|
ignored,
|
|
895
962
|
extended,
|
|
963
|
+
emitted,
|
|
896
964
|
isUsed: usage.has
|
|
897
965
|
};
|
|
898
966
|
const visit = (rule, resolved, parents) => {
|