@teambit/linter 0.0.554 → 0.0.558

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.
@@ -10,12 +10,18 @@ export declare type LintCmdOptions = {
10
10
  fixType?: string;
11
11
  json?: boolean;
12
12
  };
13
+ /**
14
+ * A type for result with componentId instead of the entire component, as when output to console, we don't want to print all the component
15
+ */
13
16
  export declare type JsonComponentLintResult = Omit<ComponentLintResult, 'component'> & {
14
17
  componentId: ComponentID;
15
18
  };
16
19
  export declare type JsonLintDataResults = Omit<LintResults, 'results'> & {
17
20
  results: JsonComponentLintResult[];
18
21
  };
22
+ /**
23
+ * A type for result with componentId instead of the entire component, as when output to console, we don't want to print all the component
24
+ */
19
25
  export declare type JsonLintResults = {
20
26
  code: number;
21
27
  data: {
@@ -2,8 +2,17 @@ import { ExecutionContext } from '@teambit/envs';
2
2
  export declare type FixType = 'problem' | 'suggestion' | 'layout';
3
3
  export declare type FixTypes = Array<FixType>;
4
4
  export interface LinterOptions {
5
+ /**
6
+ * extensions formats to lint. (e.g. .ts, .tsx, etc.)
7
+ */
5
8
  extensionFormats?: string[];
9
+ /**
10
+ * automatically fix problems
11
+ */
6
12
  fix?: boolean;
13
+ /**
14
+ * specify the types of fixes to apply (problem, suggestion, layout)
15
+ */
7
16
  fixTypes?: FixTypes;
8
17
  }
9
18
  export interface LinterContext extends ExecutionContext, LinterOptions {
package/dist/linter.d.ts CHANGED
@@ -1,40 +1,124 @@
1
1
  import { Component } from '@teambit/component';
2
2
  import { LinterContext } from './linter-context';
3
3
  export declare type ComponentLintResult = {
4
+ /**
5
+ * the linted component.
6
+ */
4
7
  component: Component;
8
+ /**
9
+ * CLI output of the linter.
10
+ */
5
11
  output: string;
12
+ /**
13
+ * total errors count of the component (from all of the files).
14
+ */
6
15
  totalErrorCount: number;
16
+ /**
17
+ * total fatal errors count of the component (from all of the files).
18
+ */
7
19
  totalFatalErrorCount?: number;
20
+ /**
21
+ * total fixable errors count of the component (from all of the files).
22
+ */
8
23
  totalFixableErrorCount?: number;
24
+ /**
25
+ * total fatal warning count of the component (from all of the files).
26
+ */
9
27
  totalFixableWarningCount?: number;
28
+ /**
29
+ * total warning count of the component (from all of the files).
30
+ */
10
31
  totalWarningCount: number;
32
+ /**
33
+ * lint results for each one of the component files
34
+ */
11
35
  results: LintResult[];
12
36
  };
13
37
  export declare type LintResult = {
38
+ /**
39
+ * path of the linted file.
40
+ */
14
41
  filePath: string;
42
+ /**
43
+ * numbers of errors found.
44
+ */
15
45
  errorCount: number;
46
+ /**
47
+ * numbers of errors found.
48
+ */
16
49
  fatalErrorCount?: number;
50
+ /**
51
+ * numbers of fixable errors found.
52
+ */
17
53
  fixableErrorCount?: number;
54
+ /**
55
+ * numbers of fixable warning found.
56
+ */
18
57
  fixableWarningCount?: number;
58
+ /**
59
+ * number of found warnings.
60
+ */
19
61
  warningCount: number;
62
+ /**
63
+ * lint messages.
64
+ */
20
65
  messages: LintMessage[];
66
+ /**
67
+ * Raw data as returned from the linter
68
+ */
21
69
  raw: any;
22
70
  };
23
71
  export declare type LintMessage = {
72
+ /**
73
+ * severity of the issue.
74
+ */
24
75
  severity: string;
76
+ /**
77
+ * stating column of the issue.
78
+ */
25
79
  column: number;
80
+ /**
81
+ * line of the issue.
82
+ */
26
83
  line: number;
84
+ /**
85
+ * end column of the issue.
86
+ */
27
87
  endColumn?: number;
88
+ /**
89
+ * end line of the issue.
90
+ */
28
91
  endLine?: number;
92
+ /**
93
+ * message of the issue.
94
+ */
29
95
  message: string;
96
+ /**
97
+ * lint suggestions.
98
+ */
30
99
  suggestions?: string[];
31
100
  };
32
101
  export declare type LintResults = {
33
102
  results: ComponentLintResult[];
103
+ /**
104
+ * total errors count of the component (from all of the components).
105
+ */
34
106
  totalErrorCount: number;
107
+ /**
108
+ * total fatal errors count of the component (from all of the components).
109
+ */
35
110
  totalFatalErrorCount?: number;
111
+ /**
112
+ * total fixable errors count of the component (from all of the components).
113
+ */
36
114
  totalFixableErrorCount?: number;
115
+ /**
116
+ * total fatal warning count of the component (from all of the components).
117
+ */
37
118
  totalFixableWarningCount?: number;
119
+ /**
120
+ * total warning count of the component (from all of the components).
121
+ */
38
122
  totalWarningCount: number;
39
123
  errors: Error[];
40
124
  };
@@ -7,6 +7,9 @@ import { LinterService } from './linter.service';
7
7
  import { LintTask } from './lint.task';
8
8
  import { FixTypes, LinterOptions } from './linter-context';
9
9
  export declare type LinterConfig = {
10
+ /**
11
+ * extension formats to lint.
12
+ */
10
13
  extensionFormats: string[];
11
14
  fixTypes?: FixTypes;
12
15
  };
@@ -15,7 +18,14 @@ export declare class LinterMain {
15
18
  private linterService;
16
19
  static runtime: import("@teambit/harmony").RuntimeDefinition;
17
20
  constructor(envs: EnvsMain, linterService: LinterService);
21
+ /**
22
+ * lint an array of components.
23
+ */
18
24
  lint(components: Component[], opts: LinterOptions): Promise<import("@teambit/envs").EnvsExecutionResult<import("./linter").LintResults>>;
25
+ /**
26
+ * create a lint task for build pipelines.
27
+ * @param name name of the task.
28
+ */
19
29
  createTask(name?: string): LintTask;
20
30
  static dependencies: import("@teambit/harmony").Aspect[];
21
31
  static defaultConfig: LinterConfig;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/linter",
3
- "version": "0.0.554",
3
+ "version": "0.0.558",
4
4
  "homepage": "https://bit.dev/teambit/defender/linter",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.defender",
8
8
  "name": "linter",
9
- "version": "0.0.554"
9
+ "version": "0.0.558"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -17,12 +17,12 @@
17
17
  "ink": "3.0.8",
18
18
  "@babel/runtime": "7.12.18",
19
19
  "core-js": "^3.0.0",
20
- "@teambit/cli": "0.0.385",
21
- "@teambit/component": "0.0.554",
22
- "@teambit/envs": "0.0.554",
23
- "@teambit/workspace": "0.0.554",
24
- "@teambit/builder": "0.0.554",
25
- "@teambit/logger": "0.0.470"
20
+ "@teambit/cli": "0.0.388",
21
+ "@teambit/component": "0.0.558",
22
+ "@teambit/envs": "0.0.558",
23
+ "@teambit/workspace": "0.0.558",
24
+ "@teambit/builder": "0.0.558",
25
+ "@teambit/logger": "0.0.473"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/lodash": "4.14.165",
@@ -34,7 +34,7 @@
34
34
  "@types/node": "12.20.4"
35
35
  },
36
36
  "peerDependencies": {
37
- "@teambit/legacy": "1.0.171",
37
+ "@teambit/legacy": "1.0.174",
38
38
  "react-dom": "^16.8.0 || ^17.0.0",
39
39
  "react": "^16.8.0 || ^17.0.0"
40
40
  },
@@ -62,12 +62,20 @@
62
62
  "react": "-"
63
63
  },
64
64
  "peerDependencies": {
65
- "@teambit/legacy": "1.0.171",
65
+ "@teambit/legacy": "1.0.174",
66
66
  "react-dom": "^16.8.0 || ^17.0.0",
67
67
  "react": "^16.8.0 || ^17.0.0"
68
68
  }
69
69
  }
70
70
  },
71
+ "files": [
72
+ "dist",
73
+ "!dist/tsconfig.tsbuildinfo",
74
+ "README.md",
75
+ "README.mdx",
76
+ "*.js",
77
+ "*.json"
78
+ ],
71
79
  "private": false,
72
80
  "engines": {
73
81
  "node": ">=12.22.0"
package/tsconfig.json CHANGED
@@ -15,9 +15,9 @@
15
15
  "skipLibCheck": true,
16
16
  "moduleResolution": "node",
17
17
  "esModuleInterop": true,
18
- "outDir": "dist",
19
18
  "composite": true,
20
19
  "emitDeclarationOnly": true,
20
+ "outDir": "dist",
21
21
  "experimentalDecorators": true,
22
22
  "emitDecoratorMetadata": true,
23
23
  "allowSyntheticDefaultImports": true,
@@ -25,7 +25,6 @@
25
25
  "strict": true,
26
26
  "noImplicitAny": false,
27
27
  "rootDir": ".",
28
- "removeComments": true,
29
28
  "preserveConstEnums": true,
30
29
  "resolveJsonModule": true
31
30
  },
package/index.ts DELETED
@@ -1,8 +0,0 @@
1
- import { LinterAspect } from './linter.aspect';
2
-
3
- export { LinterAspect };
4
- export type { LinterMain, LinterConfig } from './linter.main.runtime';
5
- export { LintResults, Linter, LintResult, ComponentLintResult } from './linter';
6
- export type { LintTask } from './lint.task';
7
- export type { LinterContext, LinterOptions } from './linter-context';
8
- export default LinterAspect;
package/lint.cmd.ts DELETED
@@ -1,144 +0,0 @@
1
- import { TimerResponse, Timer } from '@teambit/legacy/dist/toolbox/timer';
2
- import { Command, CommandOptions } from '@teambit/cli';
3
- import { ComponentFactory, ComponentID } from '@teambit/component';
4
- import chalk from 'chalk';
5
- import { EnvsExecutionResult } from '@teambit/envs';
6
- import { Workspace } from '@teambit/workspace';
7
- import { compact, flatten, omit } from 'lodash';
8
- import { LinterMain } from './linter.main.runtime';
9
- import { ComponentLintResult, LintResults } from './linter';
10
- import { FixTypes, LinterOptions } from './linter-context';
11
-
12
- export type LintCmdOptions = {
13
- changed?: boolean;
14
- fix?: boolean;
15
- fixType?: string;
16
- json?: boolean;
17
- };
18
-
19
- /**
20
- * A type for result with componentId instead of the entire component, as when output to console, we don't want to print all the component
21
- */
22
- export type JsonComponentLintResult = Omit<ComponentLintResult, 'component'> & {
23
- componentId: ComponentID;
24
- };
25
-
26
- export type JsonLintDataResults = Omit<LintResults, 'results'> & { results: JsonComponentLintResult[] };
27
- /**
28
- * A type for result with componentId instead of the entire component, as when output to console, we don't want to print all the component
29
- */
30
- export type JsonLintResults = {
31
- code: number;
32
- data: {
33
- duration: TimerResponse;
34
- lintResults: JsonLintDataResults;
35
- componentsIdsToLint: string[];
36
- };
37
- };
38
-
39
- export class LintCmd implements Command {
40
- name = 'lint [component...]';
41
- description = 'lint components in the development workspace';
42
- group = 'development';
43
- options = [
44
- ['c', 'changed', 'lint only new and modified components'],
45
- ['f', 'fix', 'automatically fix problems'],
46
- ['', 'fix-type <fixType>', 'specify the types of fixes to apply (problem, suggestion, layout)'],
47
- ['j', 'json', 'return the lint results in json format'],
48
- ] as CommandOptions;
49
-
50
- constructor(private linter: LinterMain, private componentHost: ComponentFactory, private workspace: Workspace) {}
51
-
52
- async report([components = []]: [string[]], linterOptions: LintCmdOptions) {
53
- const { code, data } = await this.json([components], linterOptions);
54
- const { duration, lintResults, componentsIdsToLint } = data;
55
- const title = chalk.bold(
56
- `linting total of ${chalk.cyan(componentsIdsToLint.length.toString())} component(s) in workspace '${chalk.cyan(
57
- this.componentHost.name
58
- )}'`
59
- );
60
-
61
- const componentsOutputs = lintResults.results
62
- .map((lintRes) => {
63
- const compTitle = chalk.bold.cyan(lintRes.componentId.toString({ ignoreVersion: true }));
64
- const compOutput = lintRes.output;
65
- return `${compTitle}\n${compOutput}`;
66
- })
67
- .join('\n');
68
-
69
- const { seconds } = duration;
70
- const summery = `linted ${chalk.cyan(componentsIdsToLint.length.toString())} components in ${chalk.cyan(
71
- seconds.toString()
72
- )}.`;
73
- return { code, data: `${title}\n\n${componentsOutputs}\n\n${summery}` };
74
- }
75
-
76
- async json([components = []]: [string[]], linterOptions: LintCmdOptions): Promise<JsonLintResults> {
77
- const timer = Timer.create();
78
- timer.start();
79
- const componentsIds = await this.getIdsToLint(components, linterOptions.changed);
80
- const componentsToLint = await this.workspace.getMany(componentsIds);
81
- const opts: LinterOptions = {
82
- fix: linterOptions.fix,
83
- fixTypes: linterOptions.fixType ? (linterOptions.fixType.split(',') as FixTypes) : undefined,
84
- };
85
- const linterResults = await this.linter.lint(componentsToLint, opts);
86
- const jsonLinterResults = toJsonLintResults(linterResults);
87
- // console.log('jsonLinterResults', JSON.stringify(jsonLinterResults, null, 2));
88
- const timerResponse = timer.stop();
89
- let code = 0;
90
- if (jsonLinterResults.totalErrorCount || jsonLinterResults.totalFatalErrorCount) {
91
- code = 1;
92
- }
93
- return {
94
- code,
95
- data: {
96
- duration: timerResponse,
97
- lintResults: jsonLinterResults,
98
- componentsIdsToLint: componentsToLint.map((comp) => comp.id.toString()),
99
- },
100
- };
101
- }
102
-
103
- private async getIdsToLint(components: string[], changed = false): Promise<ComponentID[]> {
104
- if (components.length) {
105
- return this.workspace.resolveMultipleComponentIds(components);
106
- }
107
- if (changed) {
108
- return this.workspace.getNewAndModifiedIds();
109
- }
110
- return this.componentHost.listIds();
111
- }
112
- }
113
-
114
- function toJsonLintResults(results: EnvsExecutionResult<LintResults>): JsonLintDataResults {
115
- let totalErrorCount = 0;
116
- let totalFatalErrorCount = 0;
117
- let totalFixableErrorCount = 0;
118
- let totalFixableWarningCount = 0;
119
- let totalWarningCount = 0;
120
- const newResults = results.results.map((res) => {
121
- const resultsWithoutComponent = res.data?.results.map((result) => {
122
- return Object.assign({}, { componentId: result.component.id }, omit(result, ['component']));
123
- });
124
-
125
- if (res.data) {
126
- totalErrorCount += res.data.totalErrorCount ?? 0;
127
- totalFatalErrorCount += res.data.totalFatalErrorCount ?? 0;
128
- totalFixableErrorCount += res.data.totalFixableErrorCount ?? 0;
129
- totalFixableWarningCount += res.data.totalFixableWarningCount ?? 0;
130
- totalWarningCount += res.data.totalWarningCount ?? 0;
131
- }
132
-
133
- return compact(resultsWithoutComponent);
134
- });
135
- return {
136
- results: compact(flatten(newResults)),
137
- totalErrorCount,
138
- totalFatalErrorCount,
139
- totalFixableErrorCount,
140
- totalFixableWarningCount,
141
- totalWarningCount,
142
- errors: results?.errors,
143
- };
144
- }
package/lint.task.ts DELETED
@@ -1,27 +0,0 @@
1
- import { BuildTask, BuiltTaskResult, BuildContext, ComponentResult } from '@teambit/builder';
2
- import { Linter } from './linter';
3
-
4
- export class LintTask implements BuildTask {
5
- constructor(readonly aspectId: string, readonly name = 'lint') {}
6
-
7
- async execute(context: BuildContext): Promise<BuiltTaskResult> {
8
- const linter: Linter = context.env.getLinter();
9
- const results = await linter.lint(context);
10
- const componentsResults = results.results.map(
11
- (lintResult): ComponentResult => {
12
- return {
13
- component: lintResult.component,
14
- metadata: {
15
- output: lintResult.output,
16
- results: lintResult.results,
17
- },
18
- errors: [],
19
- };
20
- }
21
- );
22
-
23
- return {
24
- componentsResults,
25
- };
26
- }
27
- }
package/linter-context.ts DELETED
@@ -1,24 +0,0 @@
1
- import { ExecutionContext } from '@teambit/envs';
2
-
3
- export type FixType = 'problem' | 'suggestion' | 'layout';
4
- export type FixTypes = Array<FixType>;
5
-
6
- export interface LinterOptions {
7
- /**
8
- * extensions formats to lint. (e.g. .ts, .tsx, etc.)
9
- */
10
- extensionFormats?: string[];
11
-
12
- /**
13
- * automatically fix problems
14
- */
15
- fix?: boolean;
16
-
17
- /**
18
- * specify the types of fixes to apply (problem, suggestion, layout)
19
- */
20
- fixTypes?: FixTypes;
21
- }
22
- export interface LinterContext extends ExecutionContext, LinterOptions {
23
- quiet?: boolean;
24
- }
package/linter.aspect.ts DELETED
@@ -1,5 +0,0 @@
1
- import { Aspect } from '@teambit/harmony';
2
-
3
- export const LinterAspect = Aspect.create({
4
- id: 'teambit.defender/linter',
5
- });
package/linter.graphql.ts DELETED
@@ -1,8 +0,0 @@
1
- import gql from 'graphql-tag';
2
-
3
- export function linterSchema() {
4
- return {
5
- typeDefs: gql``,
6
- resolvers: {},
7
- };
8
- }
@@ -1,64 +0,0 @@
1
- import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';
2
- import { Component, ComponentAspect, ComponentMain } from '@teambit/component';
3
- import { EnvsAspect, EnvsMain } from '@teambit/envs';
4
- import { LoggerAspect, LoggerMain } from '@teambit/logger';
5
- import { Workspace, WorkspaceAspect } from '@teambit/workspace';
6
- import { LinterAspect } from './linter.aspect';
7
- import { LinterService } from './linter.service';
8
- import { LintTask } from './lint.task';
9
- import { LintCmd } from './lint.cmd';
10
- import { FixTypes, LinterOptions } from './linter-context';
11
-
12
- export type LinterConfig = {
13
- /**
14
- * extension formats to lint.
15
- */
16
- extensionFormats: string[];
17
- fixTypes?: FixTypes;
18
- };
19
-
20
- export class LinterMain {
21
- static runtime = MainRuntime;
22
-
23
- constructor(private envs: EnvsMain, private linterService: LinterService) {}
24
-
25
- /**
26
- * lint an array of components.
27
- */
28
- async lint(components: Component[], opts: LinterOptions) {
29
- const envsRuntime = await this.envs.createEnvironment(components);
30
- const lintResults = envsRuntime.run(this.linterService, opts);
31
- return lintResults;
32
- }
33
-
34
- /**
35
- * create a lint task for build pipelines.
36
- * @param name name of the task.
37
- */
38
- createTask(name?: string): LintTask {
39
- return new LintTask(LinterAspect.id, name);
40
- }
41
-
42
- static dependencies = [EnvsAspect, CLIAspect, ComponentAspect, LoggerAspect, WorkspaceAspect];
43
-
44
- static defaultConfig: LinterConfig = {
45
- extensionFormats: ['.ts', '.tsx', '.js', '.jsx', '.mjs'],
46
- fixTypes: ['layout', 'problem', 'suggestion'],
47
- };
48
-
49
- static async provider(
50
- [envs, cli, component, loggerAspect, workspace]: [EnvsMain, CLIMain, ComponentMain, LoggerMain, Workspace],
51
- config: LinterConfig
52
- ) {
53
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
54
- const logger = loggerAspect.createLogger(LinterAspect.id);
55
- const linterService = new LinterService(config);
56
- const linterAspect = new LinterMain(envs, linterService);
57
- envs.registerService(linterService);
58
- cli.register(new LintCmd(linterAspect, component.getHost(), workspace));
59
-
60
- return linterAspect;
61
- }
62
- }
63
-
64
- LinterAspect.addRuntime(LinterMain);
@@ -1,76 +0,0 @@
1
- import React from 'react';
2
- import { defaults } from 'lodash';
3
- import { EnvService, ExecutionContext, EnvDefinition } from '@teambit/envs';
4
- import { Text, Newline } from 'ink';
5
- import highlight from 'cli-highlight';
6
- import { Linter, LintResults } from './linter';
7
- import { LinterContext, LinterOptions } from './linter-context';
8
- import { LinterConfig } from './linter.main.runtime';
9
-
10
- export class LinterService implements EnvService<LintResults> {
11
- name = 'linter';
12
-
13
- constructor(private linterConfig: LinterConfig) {}
14
-
15
- async run(context: ExecutionContext, options: LinterOptions): Promise<LintResults> {
16
- const mergedOpts = this.optionsWithDefaults(options);
17
- const linterContext = this.mergeContext(mergedOpts, context);
18
- const linter: Linter = context.env.getLinter(linterContext);
19
-
20
- const results = await linter.lint(linterContext);
21
- return results;
22
- }
23
-
24
- private optionsWithDefaults(options: LinterOptions): LinterOptions {
25
- return defaults(options, this.linterConfig);
26
- }
27
-
28
- private mergeContext(options: LinterOptions, context?: ExecutionContext): LinterContext {
29
- const linterContext: LinterContext = Object.assign(
30
- {},
31
- {
32
- quiet: false,
33
- extensionFormats: options.extensionFormats,
34
- fixTypes: options.fixTypes,
35
- fix: options.fix,
36
- },
37
- context
38
- );
39
- return linterContext;
40
- }
41
-
42
- render(env: EnvDefinition) {
43
- const descriptor = this.getDescriptor(env);
44
-
45
- return (
46
- <Text key={descriptor?.id}>
47
- <Text color="cyan">configured linter: </Text>
48
- <Text>
49
- {descriptor?.id} ({descriptor?.displayName} @ {descriptor?.version})
50
- </Text>
51
- <Newline />
52
- <Text color="cyan">linter config:</Text>
53
- <Newline />
54
- <Text>
55
- {descriptor?.config && highlight(descriptor?.config, { language: 'javascript', ignoreIllegals: true })}
56
- </Text>
57
- <Newline />
58
- </Text>
59
- );
60
- }
61
-
62
- getDescriptor(env: EnvDefinition) {
63
- if (!env.env.getLinter) return undefined;
64
- const mergedOpts = this.optionsWithDefaults({});
65
- const linterContext = this.mergeContext(mergedOpts);
66
- const linter = env.env.getLinter(linterContext);
67
-
68
- return {
69
- id: linter.id,
70
- icon: linter.icon,
71
- config: linter.displayConfig ? linter.displayConfig() : undefined,
72
- version: linter.version ? linter.version() : '?',
73
- displayName: linter.displayName ? linter.displayName : '?',
74
- };
75
- }
76
- }
package/linter.ts DELETED
@@ -1,147 +0,0 @@
1
- import { Component } from '@teambit/component';
2
- import { LinterContext } from './linter-context';
3
-
4
- export type ComponentLintResult = {
5
- /**
6
- * the linted component.
7
- */
8
- component: Component;
9
-
10
- /**
11
- * CLI output of the linter.
12
- */
13
- output: string;
14
-
15
- /**
16
- * total errors count of the component (from all of the files).
17
- */
18
- totalErrorCount: number;
19
- /**
20
- * total fatal errors count of the component (from all of the files).
21
- */
22
- totalFatalErrorCount?: number;
23
- /**
24
- * total fixable errors count of the component (from all of the files).
25
- */
26
- totalFixableErrorCount?: number;
27
- /**
28
- * total fatal warning count of the component (from all of the files).
29
- */
30
- totalFixableWarningCount?: number;
31
- /**
32
- * total warning count of the component (from all of the files).
33
- */
34
- totalWarningCount: number;
35
-
36
- /**
37
- * lint results for each one of the component files
38
- */
39
- results: LintResult[];
40
- };
41
-
42
- export type LintResult = {
43
- /**
44
- * path of the linted file.
45
- */
46
- filePath: string;
47
-
48
- /**
49
- * numbers of errors found.
50
- */
51
- errorCount: number;
52
-
53
- /**
54
- * numbers of errors found.
55
- */
56
- fatalErrorCount?: number;
57
-
58
- /**
59
- * numbers of fixable errors found.
60
- */
61
- fixableErrorCount?: number;
62
-
63
- /**
64
- * numbers of fixable warning found.
65
- */
66
- fixableWarningCount?: number;
67
-
68
- /**
69
- * number of found warnings.
70
- */
71
- warningCount: number;
72
-
73
- /**
74
- * lint messages.
75
- */
76
- messages: LintMessage[];
77
-
78
- /**
79
- * Raw data as returned from the linter
80
- */
81
- raw: any;
82
- };
83
-
84
- export type LintMessage = {
85
- /**
86
- * severity of the issue.
87
- */
88
- severity: string;
89
- /**
90
- * stating column of the issue.
91
- */
92
- column: number;
93
-
94
- /**
95
- * line of the issue.
96
- */
97
- line: number;
98
-
99
- /**
100
- * end column of the issue.
101
- */
102
- endColumn?: number;
103
-
104
- /**
105
- * end line of the issue.
106
- */
107
- endLine?: number;
108
-
109
- /**
110
- * message of the issue.
111
- */
112
- message: string;
113
-
114
- /**
115
- * lint suggestions.
116
- */
117
- suggestions?: string[];
118
- };
119
-
120
- export type LintResults = {
121
- results: ComponentLintResult[];
122
- /**
123
- * total errors count of the component (from all of the components).
124
- */
125
- totalErrorCount: number;
126
- /**
127
- * total fatal errors count of the component (from all of the components).
128
- */
129
- totalFatalErrorCount?: number;
130
- /**
131
- * total fixable errors count of the component (from all of the components).
132
- */
133
- totalFixableErrorCount?: number;
134
- /**
135
- * total fatal warning count of the component (from all of the components).
136
- */
137
- totalFixableWarningCount?: number;
138
- /**
139
- * total warning count of the component (from all of the components).
140
- */
141
- totalWarningCount: number;
142
- errors: Error[];
143
- };
144
-
145
- export interface Linter {
146
- lint(context: LinterContext): Promise<LintResults>;
147
- }
package/types/asset.d.ts DELETED
@@ -1,29 +0,0 @@
1
- declare module '*.png' {
2
- const value: any;
3
- export = value;
4
- }
5
- declare module '*.svg' {
6
- import type { FunctionComponent, SVGProps } from 'react';
7
-
8
- export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
9
- const src: string;
10
- export default src;
11
- }
12
-
13
- // @TODO Gilad
14
- declare module '*.jpg' {
15
- const value: any;
16
- export = value;
17
- }
18
- declare module '*.jpeg' {
19
- const value: any;
20
- export = value;
21
- }
22
- declare module '*.gif' {
23
- const value: any;
24
- export = value;
25
- }
26
- declare module '*.bmp' {
27
- const value: any;
28
- export = value;
29
- }
package/types/style.d.ts DELETED
@@ -1,42 +0,0 @@
1
- declare module '*.module.css' {
2
- const classes: { readonly [key: string]: string };
3
- export default classes;
4
- }
5
- declare module '*.module.scss' {
6
- const classes: { readonly [key: string]: string };
7
- export default classes;
8
- }
9
- declare module '*.module.sass' {
10
- const classes: { readonly [key: string]: string };
11
- export default classes;
12
- }
13
-
14
- declare module '*.module.less' {
15
- const classes: { readonly [key: string]: string };
16
- export default classes;
17
- }
18
-
19
- declare module '*.less' {
20
- const classes: { readonly [key: string]: string };
21
- export default classes;
22
- }
23
-
24
- declare module '*.css' {
25
- const classes: { readonly [key: string]: string };
26
- export default classes;
27
- }
28
-
29
- declare module '*.sass' {
30
- const classes: { readonly [key: string]: string };
31
- export default classes;
32
- }
33
-
34
- declare module '*.scss' {
35
- const classes: { readonly [key: string]: string };
36
- export default classes;
37
- }
38
-
39
- declare module '*.mdx' {
40
- const component: any;
41
- export default component;
42
- }