-
-
Notifications
You must be signed in to change notification settings - Fork 53
feat: support typescript #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2951b55
feat: support typescript
ricardogobbosouza a3df4f9
Merge branch 'master' into feat-types
ricardogobbosouza 7ee16de
feat: add types
ricardogobbosouza efa34e8
test: set testTimeout
ricardogobbosouza 7f10c35
chore: move types to dependencies
ricardogobbosouza a0446d7
chore: move @types/webpack to devDependencies
ricardogobbosouza File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| export default class DirtyFileWatcher { | ||
| /** | ||
| * @param {string|string[]=} files | ||
| * @param {string|string[]=} extensions | ||
| */ | ||
| constructor( | ||
| files?: (string | string[]) | undefined, | ||
| extensions?: (string | string[]) | undefined | ||
| ); | ||
| startTime: number; | ||
| prevTimestamps: Map<any, any>; | ||
| isFirstRun: boolean; | ||
| globs: string[]; | ||
| /** | ||
| * @param {Map<string,number>=} fileTimestamps | ||
| * @returns {string[]} | ||
| */ | ||
| getDirtyFiles(fileTimestamps?: Map<string, number> | undefined): string[]; | ||
| /** | ||
| * @param {Map<string,number>} fileTimestamps | ||
| * @param {string|string[]} globs | ||
| * @returns {string[]} | ||
| */ | ||
| filterChangedFiles( | ||
| fileTimestamps: Map<string, number>, | ||
| globs: string | string[] | ||
| ): string[]; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| export default class ESLintError extends Error { | ||
| /** | ||
| * @param {string=} messages | ||
| */ | ||
| constructor(messages?: string | undefined); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| declare const _exports: typeof import('.').default; | ||
| export = _exports; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /** @typedef {import('eslint').ESLint} ESLint */ | ||
| /** @typedef {import('./options').Options} Options */ | ||
| /** | ||
| * @param {Options} options | ||
| * @returns {{ESLint: ESLint, eslint: ESLint}} | ||
| */ | ||
| export default function getESLint( | ||
| options: Options | ||
| ): { | ||
| ESLint: import('eslint').ESLint; | ||
| eslint: import('eslint').ESLint; | ||
| }; | ||
| export type ESLint = import('eslint').ESLint; | ||
| export type Options = { | ||
| context?: string | undefined; | ||
| emitError?: boolean | undefined; | ||
| emitWarning?: boolean | undefined; | ||
| eslintPath?: string | undefined; | ||
| failOnError?: boolean | undefined; | ||
| failOnWarning?: boolean | undefined; | ||
| files?: string | string[] | undefined; | ||
| extensions?: string | string[] | undefined; | ||
| fix?: boolean | undefined; | ||
| formatter?: string | import('./options').FormatterFunction | undefined; | ||
| lintDirtyModulesOnly?: boolean | undefined; | ||
| quiet?: boolean | undefined; | ||
| outputReport?: import('./options').OutputReport | undefined; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| export default ESLintWebpackPlugin; | ||
| export type Compiler = import('webpack').Compiler; | ||
| export type Options = { | ||
| context?: string | undefined; | ||
| emitError?: boolean | undefined; | ||
| emitWarning?: boolean | undefined; | ||
| eslintPath?: string | undefined; | ||
| failOnError?: boolean | undefined; | ||
| failOnWarning?: boolean | undefined; | ||
| files?: string | string[] | undefined; | ||
| extensions?: string | string[] | undefined; | ||
| fix?: boolean | undefined; | ||
| formatter?: string | import('./options').FormatterFunction | undefined; | ||
| lintDirtyModulesOnly?: boolean | undefined; | ||
| quiet?: boolean | undefined; | ||
| outputReport?: import('./options').OutputReport | undefined; | ||
| }; | ||
| /** @typedef {import('webpack').Compiler} Compiler */ | ||
| /** @typedef {import('./options').Options} Options */ | ||
| declare class ESLintWebpackPlugin { | ||
| /** | ||
| * @param {Options} options | ||
| */ | ||
| constructor(options?: Options); | ||
| options: import('./options').Options; | ||
| /** | ||
| * @param {Compiler} compiler | ||
| * @returns {void} | ||
| */ | ||
| apply(compiler: Compiler): void; | ||
| /** | ||
| * | ||
| * @param {Compiler} compiler | ||
| * @returns {string} | ||
| */ | ||
| getContext(compiler: Compiler): string; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /** @typedef {import('eslint').ESLint} ESLint */ | ||
| /** @typedef {import('eslint').ESLint.Formatter} Formatter */ | ||
| /** @typedef {import('eslint').ESLint.LintResult} LintResult */ | ||
| /** @typedef {import('webpack').Compiler} Compiler */ | ||
| /** @typedef {import('./options').Options} Options */ | ||
| /** @typedef {import('./options').FormatterFunction} FormatterFunction */ | ||
| /** | ||
| * @param {Options} options | ||
| * @param {Compiler} compiler | ||
| * @returns {Promise<void>} | ||
| */ | ||
| export default function linter( | ||
| options: Options, | ||
| compiler: Compiler | ||
| ): Promise<void>; | ||
| export type ESLint = import('eslint').ESLint; | ||
| export type Formatter = import('eslint').ESLint.Formatter; | ||
| export type LintResult = import('eslint').ESLint.LintResult; | ||
| export type Compiler = import('webpack').Compiler; | ||
| export type Options = { | ||
| context?: string | undefined; | ||
| emitError?: boolean | undefined; | ||
| emitWarning?: boolean | undefined; | ||
| eslintPath?: string | undefined; | ||
| failOnError?: boolean | undefined; | ||
| failOnWarning?: boolean | undefined; | ||
| files?: string | string[] | undefined; | ||
| extensions?: string | string[] | undefined; | ||
| fix?: boolean | undefined; | ||
| formatter?: string | import('./options').FormatterFunction | undefined; | ||
| lintDirtyModulesOnly?: boolean | undefined; | ||
| quiet?: boolean | undefined; | ||
| outputReport?: import('./options').OutputReport | undefined; | ||
| }; | ||
| export type FormatterFunction = ( | ||
| results: import('eslint').ESLint.LintResult[], | ||
| data?: import('eslint').ESLint.LintResultData | undefined | ||
| ) => string; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| /** @typedef {import("eslint").ESLint.Options} ESLintOptions */ | ||
| /** @typedef {import('eslint').ESLint.LintResult} LintResult */ | ||
| /** @typedef {import('eslint').ESLint.LintResultData} LintResultData */ | ||
| /** | ||
| * @callback FormatterFunction | ||
| * @param {LintResult[]} results | ||
| * @param {LintResultData=} data | ||
| * @returns {string} | ||
| */ | ||
| /** | ||
| * @typedef {Object} OutputReport | ||
| * @property {string=} filePath | ||
| * @property {string|FormatterFunction=} formatter | ||
| */ | ||
| /** | ||
| * @typedef {Object} Options | ||
| * @property {string=} context | ||
| * @property {boolean=} emitError | ||
| * @property {boolean=} emitWarning | ||
| * @property {string=} eslintPath | ||
| * @property {boolean=} failOnError | ||
| * @property {boolean=} failOnWarning | ||
| * @property {string|string[]=} files | ||
| * @property {string|string[]=} extensions | ||
| * @property {boolean=} fix | ||
| * @property {string|FormatterFunction=} formatter | ||
| * @property {boolean=} lintDirtyModulesOnly | ||
| * @property {boolean=} quiet | ||
| * @property {OutputReport=} outputReport | ||
| */ | ||
| /** | ||
| * @param {Options} pluginOptions | ||
| * @returns {Options} | ||
| */ | ||
| export function getOptions(pluginOptions: Options): Options; | ||
| /** | ||
| * @param {Options} loaderOptions | ||
| * @returns {ESLintOptions} | ||
| */ | ||
| export function getESLintOptions(loaderOptions: Options): ESLintOptions; | ||
| export type ESLintOptions = import('eslint').ESLint.Options; | ||
| export type LintResult = import('eslint').ESLint.LintResult; | ||
| export type LintResultData = import('eslint').ESLint.LintResultData; | ||
ricardogobbosouza marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| export type FormatterFunction = ( | ||
| results: LintResult[], | ||
| data?: LintResultData | undefined | ||
| ) => string; | ||
| export type OutputReport = { | ||
| filePath?: string | undefined; | ||
| formatter?: (string | FormatterFunction) | undefined; | ||
| }; | ||
| export type Options = { | ||
| context?: string | undefined; | ||
| emitError?: boolean | undefined; | ||
| emitWarning?: boolean | undefined; | ||
| eslintPath?: string | undefined; | ||
| failOnError?: boolean | undefined; | ||
| failOnWarning?: boolean | undefined; | ||
| files?: (string | string[]) | undefined; | ||
| extensions?: (string | string[]) | undefined; | ||
| fix?: boolean | undefined; | ||
| formatter?: (string | FormatterFunction) | undefined; | ||
| lintDirtyModulesOnly?: boolean | undefined; | ||
| quiet?: boolean | undefined; | ||
| outputReport?: OutputReport | undefined; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /** | ||
| * @param {string|string[]} files | ||
| * @param {string} context | ||
| * @returns {string[]} | ||
| */ | ||
| export function parseFiles(files: string | string[], context: string): string[]; | ||
| /** | ||
| * @param {string} str | ||
| * @returns {string} | ||
| */ | ||
| export function replaceBackslashes(str: string): string; | ||
| /** | ||
| * @param {string|string[]} patterns | ||
| * @param {string|string[]} extensions | ||
| * @returns {string[]} | ||
| */ | ||
| export function parseFoldersToGlobs( | ||
| patterns: string | string[], | ||
| extensions: string | string[] | ||
| ): string[]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| module.exports = { | ||
| '*.js': ['prettier --write', 'eslint --fix', 'git add'], | ||
| '*.{json,md,yml,css}': ['prettier --write', 'git add'], | ||
| '*.{json,md,yml,css,ts}': ['prettier --write', 'git add'], | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.