-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3bb25ef
commit 30860fe
Showing
4 changed files
with
32 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
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import makeDiagnostic from './make-diagnostic'; | ||
import getJSONPropertyPosition from './get-json-property-position'; | ||
|
||
export { | ||
getJSONPropertyPosition, | ||
makeDiagnostic | ||
}; |
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,21 @@ | ||
import {Node} from '../../../libraries/typescript/lib/typescript'; | ||
import {Diagnostic} from '../interfaces'; | ||
|
||
/** | ||
* Create a diagnostic from the given `node`, `message` and optional `severity`. | ||
* | ||
* @param node - The TypeScript Node where this diagnostic occurs. | ||
* @param message - Message of the diagnostic. | ||
* @param severity - Severity of the diagnostic. | ||
*/ | ||
export default (node: Node, message: string, severity: 'error' | 'warning' = 'error'): Diagnostic => { | ||
const position = node.getSourceFile().getLineAndCharacterOfPosition(node.getStart()); | ||
|
||
return { | ||
fileName: node.getSourceFile().fileName, | ||
message, | ||
severity, | ||
line: position.line + 1, | ||
column: position.character, | ||
}; | ||
}; |