-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: refactors library into typscript
- Loading branch information
1 parent
9a174c2
commit a9694de
Showing
22 changed files
with
4,052 additions
and
799 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,75 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
tsconfigRootDir: __dirname, | ||
sourceType: 'module', | ||
}, | ||
plugins: ['@typescript-eslint/eslint-plugin'], | ||
extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'], | ||
env: { | ||
es6: true, | ||
node: true, | ||
jest: true, | ||
}, | ||
ignorePatterns: ['.eslintrc.js'], | ||
rules: { | ||
// https://github.com/typescript-eslint/typescript-eslint/blob/v3.2.0/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-unused-vars': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/consistent-type-assertions': 'off', | ||
'@typescript-eslint/indent': 'off', | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/member-delimiter-style': [ | ||
'off', | ||
'error', | ||
{ | ||
multiline: { | ||
delimiter: 'none', | ||
requireLast: true, | ||
}, | ||
singleline: { | ||
delimiter: 'semi', | ||
requireLast: false, | ||
}, | ||
}, | ||
], | ||
'no-param-reassign': 'error', | ||
'@typescript-eslint/member-ordering': 'off', | ||
'@typescript-eslint/no-this-alias': 'error', | ||
'@typescript-eslint/quotes': 'off', | ||
'@typescript-eslint/semi': ['off', null], | ||
'@typescript-eslint/space-within-parens': ['off', 'never'], | ||
'@typescript-eslint/type-annotation-spacing': 'off', | ||
'arrow-parens': ['off', 'as-needed'], | ||
camelcase: ['error', { properties: 'never', ignoreImports: true }], | ||
curly: ['error', 'multi-line'], | ||
'eol-last': 'off', | ||
eqeqeq: ['error', 'smart'], | ||
'id-blacklist': 'error', | ||
'id-match': 'error', | ||
'linebreak-style': 'off', | ||
'new-parens': 'off', | ||
'newline-per-chained-call': 'off', | ||
'no-console': 'off', | ||
'no-duplicate-imports': 'error', | ||
'no-eval': 'error', | ||
'no-extra-semi': 'off', | ||
'no-irregular-whitespace': 'off', | ||
'no-multiple-empty-lines': 'off', | ||
'no-new-wrappers': 'error', | ||
'no-trailing-spaces': 'off', | ||
'no-underscore-dangle': 'error', | ||
'no-var': 'error', | ||
'object-shorthand': 'error', | ||
'one-var': ['error', 'never'], | ||
'prefer-const': 'error', | ||
'prefer-template': 'error', | ||
'quote-props': 'off', | ||
radix: 'error', | ||
'space-before-function-paren': 'off', | ||
'spaced-comment': 'warn', | ||
'arrow-body-style': ['warn', 'as-needed'], | ||
}, | ||
}; |
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,3 @@ | ||
node_modules | ||
npm-debug.log | ||
lib/ |
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,10 @@ | ||
{ | ||
"printWidth": 120, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"bracketSpacing": true, | ||
"arrowParens": "avoid" | ||
} |
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,13 @@ | ||
module.exports = { | ||
moduleFileExtensions: ['js', 'json', 'ts'], | ||
rootDir: '.', | ||
testRegex: '.*\\.spec\\.ts$', | ||
transform: { | ||
'^.+\\.(t|j)s$': 'ts-jest', | ||
}, | ||
collectCoverageFrom: ['**/*.(t|j)s'], | ||
coverageDirectory: './coverage', | ||
testEnvironment: 'node', | ||
roots: ['<rootDir>/src/'], | ||
testPathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/apps/legacy/node_modules/'], | ||
}; |
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
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,25 @@ | ||
export const buildFilter = (filtersParam: string | string[]) => { | ||
const filters = filtersParam instanceof Array ? filtersParam.slice() : [filtersParam]; | ||
const filterArray = []; | ||
|
||
if (filters.length === 0) return null; | ||
|
||
while (filters.length > 0) { | ||
const filter = filters.shift(); | ||
filterArray.push( | ||
'\\/?' + | ||
filter | ||
.replace(/\./g, '\\.') | ||
.replace(/(\*?)(\*)(?!\*)/g, function (match, prefix) { | ||
if (prefix == '*') { | ||
return match; | ||
} | ||
return '[^\\/]*'; | ||
}) | ||
.replace(/\?/g, '[^\\/]?') | ||
.replace(/\*\*/g, '.*') | ||
.replace(/([\-\+\|])/g, '\\$1'), | ||
); | ||
} | ||
return new RegExp('^' + filterArray.join('|') + '$', 'i'); | ||
}; |
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 { buildFilter } from './build-filter'; | ||
|
||
describe('buildFilter', () => { | ||
it('creates a filter RegExp given a wildcard filter string', () => { | ||
const result = buildFilter('*'); | ||
|
||
expect(result).toEqual(/^\/?[^\/]*$/i); | ||
}); | ||
|
||
it('creates a filter RegExp given a wildcard filter string', () => { | ||
const result = buildFilter('**'); | ||
|
||
expect(result).toEqual(/^\/?.*$/i); | ||
}); | ||
|
||
it('creates a filter RegExp given an array of filters', () => { | ||
const result = buildFilter(['**/*123*', '**/abc.*']); | ||
|
||
expect(result).toEqual(/^\/?.*\/[^\/]*123[^\/]*|\/?.*\/abc\.[^\/]*$/i); | ||
}); | ||
}); |
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,5 @@ | ||
export enum FilenameFormat { | ||
RELATIVE = 0, | ||
FULL_PATH, | ||
FILENAME, | ||
} |
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 @@ | ||
export * from './consts'; | ||
export * from './readfiles'; | ||
export { readfiles as default } from './readfiles'; |
Oops, something went wrong.