-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(pkg): new linter and updated typescript support
- Loading branch information
Showing
41 changed files
with
553 additions
and
386 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
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,18 +1,12 @@ | ||
import { GetEnvVarOptions } from './types'; | ||
export declare function getEnvVars(options?: GetEnvVarOptions): Promise<{ | ||
[key: string]: any; | ||
}>; | ||
export declare function getEnvVars(options?: GetEnvVarOptions): Promise<Record<string, any>>; | ||
export declare function getEnvFile({ filePath, fallback, verbose }: { | ||
filePath?: string; | ||
fallback?: boolean; | ||
verbose?: boolean; | ||
}): Promise<{ | ||
[key: string]: any; | ||
}>; | ||
}): Promise<Record<string, any>>; | ||
export declare function getRCFile({ environments, filePath, verbose }: { | ||
environments: string[]; | ||
filePath?: string; | ||
verbose?: boolean; | ||
}): Promise<{ | ||
[key: string]: any; | ||
}>; | ||
}): Promise<Record<string, any>>; |
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
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,43 @@ | ||
const eslint = require('@eslint/js') | ||
const tseslint = require('typescript-eslint') | ||
const globals = require('globals') | ||
const stylistic = require('@stylistic/eslint-plugin') | ||
|
||
module.exports = tseslint.config( | ||
{ | ||
ignores: ['dist/*', 'bin/*'], | ||
rules: { | ||
'@typescript-eslint/no-require-imports': 'off', | ||
}, | ||
languageOptions: { | ||
globals: { | ||
...globals.node, | ||
}, | ||
parserOptions: { | ||
projectService: { | ||
allowDefaultProject: ['test/*.ts'], | ||
}, | ||
}, | ||
}, | ||
extends: [ | ||
eslint.configs.recommended, | ||
stylistic.configs['recommended-flat'], | ||
tseslint.configs.strictTypeChecked, | ||
tseslint.configs.stylisticTypeChecked, | ||
], | ||
}, | ||
// Disable Type Checking JS files | ||
{ | ||
files: ['**/*.js'], | ||
extends: [tseslint.configs.disableTypeChecked], | ||
}, | ||
{ | ||
// For test files ignore some rules | ||
files: ['test/*.ts'], | ||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-unsafe-member-access': 'off', | ||
'@typescript-eslint/no-unsafe-assignment': 'off', | ||
}, | ||
}, | ||
) |
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,26 @@ | ||
module.exports = (async function config() { | ||
const { default: love } = await import('eslint-config-love') | ||
|
||
return [ | ||
love, | ||
{ | ||
files: [ | ||
'src/**/*.[j|t]s', | ||
// 'src/**/*.ts', | ||
'test/**/*.[j|t]s', | ||
// 'test/**/*.ts' | ||
], | ||
languageOptions: { | ||
parserOptions: { | ||
projectService: { | ||
allowDefaultProject: ['eslint.config.js', 'bin/env-cmd.js'], | ||
defaultProject: './tsconfig.json', | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
ignores: ['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
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,11 +1,13 @@ | ||
import { Environment } from './types' | ||
|
||
/** | ||
* expandEnvs Replaces $var in args and command with environment variables | ||
* the environment variable doesn't exist, it leaves it as is. | ||
* if the environment variable doesn't exist, it leaves it as is. | ||
*/ | ||
export function expandEnvs (str: string, envs: { [key: string]: any }): string { | ||
return str.replace(/(?<!\\)\$[a-zA-Z0-9_]+/g, varName => { | ||
export function expandEnvs(str: string, envs: Environment): string { | ||
return str.replace(/(?<!\\)\$[a-zA-Z0-9_]+/g, (varName) => { | ||
const varValue = envs[varName.slice(1)] | ||
return varValue === undefined ? varName : varValue | ||
// const test = 42; | ||
return varValue === undefined ? varName : varValue.toString() | ||
}) | ||
} |
Oops, something went wrong.