-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: include type definitions (#186)
* fix: include type definitions * chore: turn off no-unused-vars for the sink base class We want them for JSDoc
- Loading branch information
Showing
17 changed files
with
293 additions
and
148 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
; http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
* text=auto eol=lf |
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 |
---|---|---|
|
@@ -13,4 +13,5 @@ tmp/**/* | |
coverage | ||
.vscode | ||
.nyc_output/ | ||
.tap/ | ||
.tap/ | ||
types/ |
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 +1,2 @@ | ||
package-lock=false | ||
save-exact=true |
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,22 @@ | ||
import prettierConfig from 'eslint-config-prettier'; | ||
import prettierPlugin from 'eslint-plugin-prettier/recommended'; | ||
import globals from 'globals'; | ||
import js from '@eslint/js'; | ||
|
||
export default [ | ||
js.configs.recommended, | ||
prettierConfig, | ||
prettierPlugin, | ||
{ | ||
languageOptions: { | ||
globals: { | ||
...globals.node, | ||
...globals.browser, | ||
global: true, | ||
}, | ||
}, | ||
}, | ||
{ | ||
ignores: ['coverage/*', 'dist/*'], | ||
}, | ||
]; |
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,38 +1,75 @@ | ||
const Sink = class Sink { | ||
write() { | ||
/* eslint-disable no-unused-vars */ | ||
export default class Sink { | ||
/** | ||
* @template [T=unknown] | ||
* @param {string} filePath Path to the file to be stored. | ||
* @param {string} contentType The content type of the file (ex `application/javascript`). | ||
* @returns {T | Promise<T>} | ||
*/ | ||
write(filePath, contentType) { | ||
throw new Error('.write method is not implemented'); | ||
} | ||
|
||
read() { | ||
/** | ||
* @template [T=unknown] | ||
* @param {string} filePath | ||
* @returns {T | Promise<T>} | ||
*/ | ||
read(filePath) { | ||
throw new Error('.read method is not implemented'); | ||
} | ||
|
||
delete() { | ||
/** | ||
* @template [T=unknown] | ||
* @param {string} filePath | ||
* @returns {T | Promise<T>} | ||
*/ | ||
delete(filePath) { | ||
throw new Error('.delete method is not implemented'); | ||
} | ||
|
||
exist() { | ||
/** | ||
* @template [T=unknown] | ||
* @param {string} filePath | ||
* @returns {T | Promise<T>} | ||
*/ | ||
exist(filePath) { | ||
throw new Error('.exist method is not implemented'); | ||
} | ||
|
||
get metrics() { | ||
throw new Error('.metrics getter is not implemented'); | ||
} | ||
|
||
/** | ||
* Validates {@link filePath} and returns it. | ||
* @param {string} filePath | ||
* @throws {TypeError} if validation fails | ||
* @returns {string} | ||
*/ | ||
static validateFilePath(filePath) { | ||
if (typeof filePath !== 'string') throw new TypeError('Argument must be a String'); | ||
if (filePath === '') throw new TypeError('Argument can not be an empty String'); | ||
if (typeof filePath !== 'string') | ||
throw new TypeError('Argument must be a String'); | ||
if (filePath === '') | ||
throw new TypeError('Argument can not be an empty String'); | ||
return filePath; | ||
} | ||
|
||
/** | ||
* Validates {@link contentType} and returns it. | ||
* @param {string} contentType | ||
* @throws {TypeError} if validation fails | ||
* @returns {string} | ||
*/ | ||
static validateContentType(contentType) { | ||
if (typeof contentType !== 'string') throw new TypeError('Argument must be a String'); | ||
if (contentType === '') throw new TypeError('Argument can not be an empty String'); | ||
if (typeof contentType !== 'string') | ||
throw new TypeError('Argument must be a String'); | ||
if (contentType === '') | ||
throw new TypeError('Argument can not be an empty String'); | ||
return contentType; | ||
} | ||
|
||
get [Symbol.toStringTag]() { | ||
return 'Sink'; | ||
} | ||
}; | ||
export default Sink; | ||
} |
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,15 +1,21 @@ | ||
module.exports = { | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/changelog", | ||
["@semantic-release/npm", { | ||
"tarballDir": "release" | ||
}], | ||
["@semantic-release/github", { | ||
"assets": "release/*.tgz" | ||
}], | ||
"@semantic-release/git" | ||
plugins: [ | ||
'@semantic-release/commit-analyzer', | ||
'@semantic-release/release-notes-generator', | ||
'@semantic-release/changelog', | ||
[ | ||
'@semantic-release/npm', | ||
{ | ||
tarballDir: 'release', | ||
}, | ||
], | ||
[ | ||
'@semantic-release/github', | ||
{ | ||
assets: 'release/*.tgz', | ||
}, | ||
], | ||
'@semantic-release/git', | ||
], | ||
"preset": "angular" | ||
} | ||
preset: 'angular', | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.