-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into requireFenceJson
- Loading branch information
Showing
12 changed files
with
51 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
"tags": [ "tagA" ], | ||
"exports": { | ||
"componentA": "*" | ||
} | ||
}, | ||
"imports":[] | ||
} |
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,7 +1,27 @@ | ||
import * as path from 'path'; | ||
import getOptions from '../utils/getOptions'; | ||
import Config from '../types/Config'; | ||
|
||
export default function reportError( | ||
message: string, | ||
sourceFile: string, | ||
rawImport: string, | ||
config: Config | ||
) { | ||
let fencePath = config.path + path.sep + 'fence.json'; | ||
|
||
let detailedMessage = | ||
`Good-fences violation in ${sourceFile}:\n` + | ||
` ${message}: ${rawImport}\n` + | ||
` Fence: ${fencePath}`; | ||
|
||
export default function reportError(message: string) { | ||
if (getOptions().onError) { | ||
getOptions().onError(message); | ||
getOptions().onError({ | ||
message, | ||
sourceFile, | ||
rawImport, | ||
fencePath, | ||
detailedMessage, | ||
}); | ||
} | ||
} |
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,7 +1,9 @@ | ||
import NormalizedPath from './NormalizedPath'; | ||
import ValidationError from './ValidationError'; | ||
|
||
export default interface NormalizedOptions { | ||
project: NormalizedPath; | ||
rootDir: NormalizedPath; | ||
onError?: (message: string) => void; | ||
ignoreExternalFences: boolean; | ||
onError?: (error: ValidationError) => void; | ||
}; |
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,5 +1,8 @@ | ||
import ValidationError from './ValidationError'; | ||
|
||
export default interface Options { | ||
project?: string; | ||
rootDir?: string; | ||
onError?: (message: string) => void; | ||
ignoreExternalFences?: boolean; | ||
onError?: (error: ValidationError) => void; | ||
}; |
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,7 @@ | ||
export default interface ValidationError { | ||
message: string; | ||
sourceFile: string; | ||
rawImport: string; | ||
fencePath: string; | ||
detailedMessage: string; | ||
}; |
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
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