@shigen/eslint-plugin 0.6.0 → 0.7.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.
@@ -0,0 +1,4 @@
1
+ import type { ESLint } from 'eslint';
2
+ declare const plugin: ESLint.Plugin;
3
+ export default plugin;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKrC,QAAA,MAAM,MAAM,EAAE,MAAM,CAAC,MAKpB,CAAC;AAEF,eAAe,MAAM,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAGA,yDAA6D;AAC7D,uDAA2D;AAE3D,MAAM,MAAM,GAAG;IACd,KAAK,EAAE;QACN,eAAe,EAAE,oBAAY;QAC7B,cAAc,EAAE,mBAAW;KAC3B;CACD,CAAC;AAEF,kBAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAGA,yDAA6D;AAC7D,uDAA2D;AAE3D,MAAM,MAAM,GAAkB;IAC7B,KAAK,EAAE;QACN,eAAe,EAAE,oBAAY;QAC7B,cAAc,EAAE,mBAAW;KAC3B;CACD,CAAC;AAEF,kBAAe,MAAM,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { RuleModule } from '../tools/rule';
2
+ export type ModuleClassOption = 'node' | 'external' | 'absolute' | 'relative';
3
+ export type TypeImportOption = 'include' | 'exclude' | 'only';
4
+ declare const ModuleClass_base: import("@shigen/enum").EnumConstructor<{
5
+ Key: ModuleClassOption;
6
+ }, [fields: {
7
+ readonly name?: string | undefined;
8
+ readonly key: ModuleClassOption;
9
+ }]>;
10
+ export declare class ModuleClass extends ModuleClass_base {
11
+ static readonly Node: ModuleClass;
12
+ static readonly External: ModuleClass;
13
+ static readonly Absolute: ModuleClass;
14
+ static readonly Relative: ModuleClass;
15
+ }
16
+ declare const TypeImport_base: import("@shigen/enum").EnumConstructor<{
17
+ Key: TypeImportOption;
18
+ }, [fields: {
19
+ readonly name?: string | undefined;
20
+ readonly key: TypeImportOption;
21
+ }]>;
22
+ export declare class TypeImport extends TypeImport_base {
23
+ static readonly Include: TypeImport;
24
+ static readonly Exclude: TypeImport;
25
+ static readonly Only: TypeImport;
26
+ }
27
+ interface ModuleClassConfiguration {
28
+ class: ModuleClassOption;
29
+ types?: TypeImportOption;
30
+ }
31
+ interface ModulePathConfiguration {
32
+ path: string;
33
+ types?: TypeImportOption;
34
+ }
35
+ type ModuleConfiguration = string | ModulePathConfiguration | ModuleClassConfiguration;
36
+ export type GroupConfiguration = ModuleConfiguration | ModuleConfiguration[];
37
+ export declare const rule: RuleModule<GroupConfiguration[]>;
38
+ export {};
39
+ //# sourceMappingURL=group-imports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-imports.d.ts","sourceRoot":"","sources":["../../src/rules/group-imports.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,eAAe,CAAC;AAK7D,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC;AAC9E,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;;SAKjB,iBAAiB;;;;;AAA9D,qBAAa,WAAY,SAAQ,gBAA+C;IAC/E,MAAM,CAAC,QAAQ,CAAC,IAAI,cAAmD;IACvE,MAAM,CAAC,QAAQ,CAAC,QAAQ,cAAuD;IAC/E,MAAM,CAAC,QAAQ,CAAC,QAAQ,cAAuD;IAC/E,MAAM,CAAC,QAAQ,CAAC,QAAQ,cAAuD;CAC/E;;SAE2C,gBAAgB;;;;;AAA5D,qBAAa,UAAW,SAAQ,eAA6C;IAC5E,MAAM,CAAC,QAAQ,CAAC,OAAO,aAAoD;IAC3E,MAAM,CAAC,QAAQ,CAAC,OAAO,aAAoD;IAC3E,MAAM,CAAC,QAAQ,CAAC,IAAI,aAAiD;CACrE;AAED,UAAU,wBAAwB;IACjC,KAAK,EAAE,iBAAiB,CAAC;IACzB,KAAK,CAAC,EAAE,gBAAgB,CAAC;CACzB;AAED,UAAU,uBAAuB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,gBAAgB,CAAC;CACzB;AAED,KAAK,mBAAmB,GAAG,MAAM,GAAG,uBAAuB,GAAG,wBAAwB,CAAC;AAEvF,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,GAAG,mBAAmB,EAAE,CAAC;AAgL7E,eAAO,MAAM,IAAI,EAAE,UAAU,CAAC,kBAAkB,EAAE,CAuHjD,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { RuleModule } from '../tools/rule';
2
+ import type { SortOptions } from '../tools/sort';
3
+ export type GroupPositionOption = 'ignore' | 'top' | 'bottom' | 'above-value' | 'below-value';
4
+ export type InlinePositionOption = 'ignore' | 'start' | 'end';
5
+ declare const TypeImportGroupPosition_base: import("@shigen/enum").EnumConstructor<{
6
+ Key: GroupPositionOption;
7
+ }, [fields: {
8
+ readonly name?: string | undefined;
9
+ readonly key: GroupPositionOption;
10
+ }]>;
11
+ export declare class TypeImportGroupPosition extends TypeImportGroupPosition_base {
12
+ static readonly Ignore: TypeImportGroupPosition;
13
+ static readonly Top: TypeImportGroupPosition;
14
+ static readonly Bottom: TypeImportGroupPosition;
15
+ static readonly AboveValue: TypeImportGroupPosition;
16
+ static readonly BelowValue: TypeImportGroupPosition;
17
+ }
18
+ declare const TypeImportInlinePosition_base: import("@shigen/enum").EnumConstructor<{
19
+ Key: InlinePositionOption;
20
+ }, [fields: {
21
+ readonly name?: string | undefined;
22
+ readonly key: InlinePositionOption;
23
+ }]>;
24
+ export declare class TypeImportInlinePosition extends TypeImportInlinePosition_base {
25
+ static readonly Ignore: TypeImportInlinePosition;
26
+ static readonly Start: TypeImportInlinePosition;
27
+ static readonly End: TypeImportInlinePosition;
28
+ }
29
+ export interface Configuration extends SortOptions {
30
+ specifier: 'source' | 'rename';
31
+ sortExports: boolean;
32
+ typesInGroup: GroupPositionOption;
33
+ inlineTypes: InlinePositionOption;
34
+ }
35
+ export declare const rule: RuleModule<[Partial<Configuration>?]>;
36
+ export {};
37
+ //# sourceMappingURL=sort-imports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sort-imports.d.ts","sourceRoot":"","sources":["../../src/rules/sort-imports.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAKjD,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,aAAa,GAAG,aAAa,CAAC;AAC9F,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;;SAKL,mBAAmB;;;;;AAA5E,qBAAa,uBAAwB,SAAQ,4BAA6D;IACzG,MAAM,CAAC,QAAQ,CAAC,MAAM,0BAA6E;IACnG,MAAM,CAAC,QAAQ,CAAC,GAAG,0BAA0E;IAC7F,MAAM,CAAC,QAAQ,CAAC,MAAM,0BAA6E;IACnG,MAAM,CAAC,QAAQ,CAAC,UAAU,0BAAkF;IAC5G,MAAM,CAAC,QAAQ,CAAC,UAAU,0BAAkF;CAC5G;;SAEyD,oBAAoB;;;;;AAA9E,qBAAa,wBAAyB,SAAQ,6BAA+D;IAC5G,MAAM,CAAC,QAAQ,CAAC,MAAM,2BAA+E;IACrG,MAAM,CAAC,QAAQ,CAAC,KAAK,2BAA8E;IACnG,MAAM,CAAC,QAAQ,CAAC,GAAG,2BAA4E;CAC/F;AAED,MAAM,WAAW,aAAc,SAAQ,WAAW;IACjD,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC/B,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,mBAAmB,CAAC;IAClC,WAAW,EAAE,oBAAoB,CAAC;CAClC;AAYD,eAAO,MAAM,IAAI,EAAE,UAAU,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAoLtD,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { TSESTree } from '@typescript-eslint/types';
2
+ import type { AST, SourceCode } from 'eslint';
3
+ import type estree from 'estree';
4
+ export type ImportModuleDeclaration = estree.ImportDeclaration & Partial<Pick<TSESTree.ImportDeclaration, 'importKind'>>;
5
+ export type ExportModuleDeclaration = estree.ExportAllDeclaration & Partial<Pick<estree.ExportNamedDeclaration, 'specifiers'> & Pick<TSESTree.ExportAllDeclaration, 'exportKind'>>;
6
+ export type ModuleDeclaration = ImportModuleDeclaration | ExportModuleDeclaration;
7
+ export type ImportSpecifier = estree.ImportSpecifier & Partial<Pick<TSESTree.ImportSpecifier, 'importKind'>>;
8
+ export type ExportSpecifier = estree.ExportSpecifier & Partial<Pick<TSESTree.ExportSpecifier, 'exportKind'>>;
9
+ export declare function importModules(source: SourceCode): ImportModuleDeclaration[];
10
+ export declare function exportModules(source: SourceCode): ExportModuleDeclaration[];
11
+ export declare function isTypeImportOrExport(node: ModuleDeclaration | ImportSpecifier | ExportSpecifier): boolean;
12
+ export declare function extrema<T extends estree.Node>(source: readonly T[]): [T, T];
13
+ export declare function linesBetween(a: estree.Node | undefined, b: estree.Node | undefined): number;
14
+ export declare function isComment(value: AST.Token | estree.Comment | estree.Node): value is estree.Comment;
15
+ export declare function assertLoc(value: {
16
+ loc?: AST.SourceLocation | null;
17
+ } | undefined): AST.SourceLocation;
18
+ export declare function assertRange(value: {
19
+ range?: AST.Range | null;
20
+ } | undefined): AST.Range;
21
+ //# sourceMappingURL=ast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast.d.ts","s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E;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,IAAI,GAAG,SAAS,EAAE,CAAC,EAAE,MAAM,CAAC,IAAI,GAAG,SAAS,GAAG,MAAM,CAM3F;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,GAAG,KAAK,IAAI,MAAM,CAAC,OAAO,CAElG;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAAE,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,GAAG,IAAI,CAAA;CAAE,GAAG,SAAS,GAAG,GAAG,CAAC,cAAc,CAMpG;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE;IAAE,KAAK,CAAC,EAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAA;CAAE,GAAG,SAAS,GAAG,GAAG,CAAC,KAAK,CAMtF"}
@@ -0,0 +1,14 @@
1
+ import type { Rule } from 'eslint';
2
+ import type { Node } from 'estree';
3
+ export interface RuleContext<Configuration extends unknown[]> extends Rule.RuleContext {
4
+ options: Configuration;
5
+ }
6
+ export interface RuleModule<Configuration extends unknown[]> extends Rule.RuleModule {
7
+ create: (context: RuleContext<Configuration>) => Rule.RuleListener;
8
+ }
9
+ export declare function fixRange(context: Rule.RuleContext, data: {
10
+ range: [Node, Node];
11
+ message: string;
12
+ code: string;
13
+ }): void;
14
+ //# sourceMappingURL=rule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../src/tools/rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEnC,MAAM,WAAW,WAAW,CAAC,aAAa,SAAS,OAAO,EAAE,CAAE,SAAQ,IAAI,CAAC,WAAW;IACrF,OAAO,EAAE,aAAa,CAAC;CACvB;AAED,MAAM,WAAW,UAAU,CAAC,aAAa,SAAS,OAAO,EAAE,CAAE,SAAQ,IAAI,CAAC,UAAU;IACnF,MAAM,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC,YAAY,CAAC;CACnE;AAED,wBAAgB,QAAQ,CACvB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,IAAI,EAAE;IACL,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACb,GACC,IAAI,CAcN"}
@@ -0,0 +1,8 @@
1
+ export type SortOptions = Pick<Intl.CollatorOptions, 'sensitivity' | 'ignorePunctuation' | 'numeric' | 'caseFirst'> & {
2
+ locales?: string[];
3
+ caseGroups?: boolean;
4
+ };
5
+ export declare function sortByPath<T extends object, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]>(source: T[], path: readonly [K1, K2, K3], options?: SortOptions): T[];
6
+ export declare function sortByPath<T extends object, K1 extends keyof T, K2 extends keyof T[K1]>(source: T[], path: readonly [K1, K2], options?: SortOptions): T[];
7
+ export declare function sortByPath<T extends object, K extends keyof T>(source: T[], path: readonly [K], options?: SortOptions): T[];
8
+ //# sourceMappingURL=sort.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../src/tools/sort.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,aAAa,GAAG,mBAAmB,GAAG,SAAS,GAAG,WAAW,CAAC,GAAG;IACrH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAqDF,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,SAAS,MAAM,CAAC,EAAE,EAAE,SAAS,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,SAAS,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,CAAC,EAAE,CAAC;AAE3L,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,SAAS,MAAM,CAAC,EAAE,EAAE,SAAS,MAAM,CAAC,CAAC,EAAE,CAAC,EACtF,MAAM,EAAE,CAAC,EAAE,EACX,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,EACvB,OAAO,CAAC,EAAE,WAAW,GACnB,CAAC,EAAE,CAAC;AAEP,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAC7D,MAAM,EAAE,CAAC,EAAE,EACX,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAClB,OAAO,CAAC,EAAE,WAAW,GACnB,CAAC,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shigen/eslint-plugin",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "General purpose plugin for ESLint",
5
5
  "keywords": [
6
6
  "eslint",
@@ -20,6 +20,7 @@
20
20
  "dist/**/*"
21
21
  ],
22
22
  "main": "dist/index.js",
23
+ "types": "dist/index.d.ts",
23
24
  "wireit": {
24
25
  "prepublishOnly": {
25
26
  "dependencies": [