-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from akvelon/issue51_prettier
Prettier (#51)
- Loading branch information
Showing
16 changed files
with
130 additions
and
113 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -2,3 +2,4 @@ rootProject.name = "dart-highlighting" | |
|
||
include(":flutter_highlighting") | ||
include(":highlighting") | ||
include(":tool") |
This file contains 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,3 @@ | ||
{ | ||
"trailingComma": "all" | ||
} |
This file contains 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,27 @@ | ||
tasks.register("precommit") { | ||
dependsOn("npxTsc") | ||
dependsOn("format") | ||
} | ||
|
||
tasks.register("npxTsc") { | ||
doLast { | ||
exec { | ||
executable("npm") | ||
args("install") | ||
} | ||
|
||
exec { | ||
executable("npx") | ||
args("tsc") | ||
} | ||
} | ||
} | ||
|
||
tasks.register("format") { | ||
doLast { | ||
exec { | ||
executable("npx") | ||
args("prettier", "--write", "src") | ||
} | ||
} | ||
} |
This file contains 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 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 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 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 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,50 +1,53 @@ | ||
// TODO: Import types from highlight.js instead of this, https://github.com/akvelon/dart-highlighting/issues/50 | ||
|
||
export interface CallbackResponse { | ||
data: Record<string, any> | ||
ignoreMatch: () => void | ||
isMatchIgnored: boolean | ||
data: Record<string, any>; | ||
ignoreMatch: () => void; | ||
isMatchIgnored: boolean; | ||
} | ||
|
||
export type ModeCallback = (match: RegExpMatchArray, response: CallbackResponse) => void; | ||
export type ModeCallback = ( | ||
match: RegExpMatchArray, | ||
response: CallbackResponse, | ||
) => void; | ||
|
||
interface ModeCallbacks { | ||
"on:end"?: Function, | ||
"on:begin"?: ModeCallback | ||
"on:end"?: Function; | ||
"on:begin"?: ModeCallback; | ||
} | ||
|
||
interface ModeDetails { | ||
begin?: RegExp | string | (RegExp | string)[] | ||
match?: RegExp | string | (RegExp | string)[] | ||
end?: RegExp | string | (RegExp | string)[] | ||
// deprecated in favor of `scope` | ||
className?: string | ||
scope?: string | Record<number, string> | ||
beginScope?: string | Record<number, string> | ||
endScope?: string | Record<number, string> | ||
contains?: ("self" | Mode)[] | ||
endsParent?: boolean | ||
endsWithParent?: boolean | ||
endSameAsBegin?: boolean | ||
skip?: boolean | ||
excludeBegin?: boolean | ||
excludeEnd?: boolean | ||
returnBegin?: boolean | ||
returnEnd?: boolean | ||
__beforeBegin?: Function | ||
parent?: Mode | ||
starts?:Mode | ||
lexemes?: string | RegExp | ||
keywords?: Record<string, any> | string | ||
beginKeywords?: string | ||
relevance?: number | ||
illegal?: string | RegExp | Array<string | RegExp> | ||
variants?: Mode[] | ||
cachedVariants?: Mode[] | ||
// parsed | ||
subLanguage?: string | string[] | ||
isCompiled?: boolean | ||
label?: string | ||
begin?: RegExp | string | (RegExp | string)[]; | ||
match?: RegExp | string | (RegExp | string)[]; | ||
end?: RegExp | string | (RegExp | string)[]; | ||
// deprecated in favor of `scope` | ||
className?: string; | ||
scope?: string | Record<number, string>; | ||
beginScope?: string | Record<number, string>; | ||
endScope?: string | Record<number, string>; | ||
contains?: ("self" | Mode)[]; | ||
endsParent?: boolean; | ||
endsWithParent?: boolean; | ||
endSameAsBegin?: boolean; | ||
skip?: boolean; | ||
excludeBegin?: boolean; | ||
excludeEnd?: boolean; | ||
returnBegin?: boolean; | ||
returnEnd?: boolean; | ||
__beforeBegin?: Function; | ||
parent?: Mode; | ||
starts?: Mode; | ||
lexemes?: string | RegExp; | ||
keywords?: Record<string, any> | string; | ||
beginKeywords?: string; | ||
relevance?: number; | ||
illegal?: string | RegExp | Array<string | RegExp>; | ||
variants?: Mode[]; | ||
cachedVariants?: Mode[]; | ||
// parsed | ||
subLanguage?: string | string[]; | ||
isCompiled?: boolean; | ||
label?: string; | ||
} | ||
|
||
export interface Mode extends ModeCallbacks, ModeDetails {} |
This file contains 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,2 +1,2 @@ | ||
// This is a placeholder so that we can import the below module that has no type information. | ||
declare module 'highlight.js'; | ||
declare module "highlight.js"; |
This file contains 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,2 +1,2 @@ | ||
// This is a placeholder so that we can import the below module that has no type information. | ||
declare module 'highlight.js/lib/languages/javascript'; | ||
declare module "highlight.js/lib/languages/javascript"; |
This file contains 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,2 +1,2 @@ | ||
// This is a placeholder so that we can import the below module that has no type information. | ||
declare module 'highlight.js/lib/languages/mathematica'; | ||
declare module "highlight.js/lib/languages/mathematica"; |
This file contains 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,2 +1,2 @@ | ||
// This is a placeholder so that we can import the below module that has no type information. | ||
declare module 'highlight.js/lib/languages/php'; | ||
declare module "highlight.js/lib/languages/php"; |
This file contains 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,2 +1,2 @@ | ||
// This is a placeholder so that we can import the below module that has no type information. | ||
declare module 'highlight.js/lib/languages/ruby'; | ||
declare module "highlight.js/lib/languages/ruby"; |
This file contains 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,2 +1,2 @@ | ||
// This is a placeholder so that we can import the below module that has no type information. | ||
declare module 'highlight.js/lib/languages/typescript'; | ||
declare module "highlight.js/lib/languages/typescript"; |
This file contains 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,11 +1,11 @@ | ||
export type StringObject<T> = { [key: string]: T }; | ||
|
||
export function expand<T>(arrays: T[][]): T[] { | ||
const result: T[] = []; | ||
const result: T[] = []; | ||
|
||
for (const arr of arrays) { | ||
result.push(...arr); | ||
} | ||
for (const arr of arrays) { | ||
result.push(...arr); | ||
} | ||
|
||
return result; | ||
return result; | ||
} |