-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RTG-1182: Enabling ES modules and refactoring
Changes: - Removes crypto library, since extension relies on webcrypto API and sjcl libraries. - creating a voprf module. - Making Jest to work with ESM. - Adding linter and formating files with prettier. - Fix return type. - Rename a listener file. - Replacing ProviderID -> ProviderId. - Removing plural from providers. - Replacing HCaptcha -> Hcaptcha. - Adding contributor guide. - Adding return types to satisfy linter. - Removing default exports. - Add strickNullChecks to configuration. - Removing yarn related files. - Removing isomorphic-webcrypto. - Attaching TABS variable to window global object.
- Loading branch information
Showing
38 changed files
with
2,487 additions
and
1,410 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,45 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 2020, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint", | ||
"security", | ||
"prettier" | ||
], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:security/recommended", | ||
"plugin:prettier/recommended", | ||
"prettier" | ||
], | ||
"rules": { | ||
"@typescript-eslint/member-delimiter-style": 0, | ||
"@typescript-eslint/no-namespace": [ | ||
"warn" | ||
], | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ | ||
"argsIgnorePattern": "^_" | ||
} | ||
], | ||
"no-case-declarations": 0, | ||
"no-console": [ | ||
"error", | ||
{ | ||
"allow": [ | ||
"warn", | ||
"error" | ||
] | ||
} | ||
] | ||
} | ||
} |
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,3 +1,4 @@ | ||
*.swp | ||
/node_modules | ||
/dist | ||
/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,7 @@ | ||
{ | ||
"semi": true, | ||
"singleQuote": true, | ||
"tabWidth": 4, | ||
"trailingComma": "all", | ||
"printWidth": 100 | ||
} |
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 @@ | ||
## Contribution Guidelines | ||
|
||
### Code Style | ||
|
||
Code is written in TypeScript and is automatically formatted with prettier. | ||
|
||
``` | ||
$ npm run lint | ||
``` | ||
|
||
### Naming convention | ||
|
||
It is recommended to follow style guide for [TypeScript](https://google.github.io/styleguide/tsguide.html). |
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,12 +1,18 @@ | ||
/** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
export default { | ||
preset: 'ts-jest/presets/js-with-ts-esm', | ||
setupFiles: ['./jest.setup.ts'], | ||
globals: { | ||
'ts-jest': { | ||
useESM: true, | ||
}, | ||
}, | ||
transform: {}, | ||
transformIgnorePatterns: ['.js'], | ||
testEnvironment: 'jsdom', | ||
moduleNameMapper: { | ||
"^@root/(.*)": "<rootDir>/$1", | ||
"^@public/(.*)": "<rootDir>/public/$1", | ||
"^@background/(.*)": "<rootDir>/src/background/$1", | ||
"^@popup/(.*)": "<rootDir>/src/popup/$1" | ||
'^@root/(.*)': '<rootDir>/$1', | ||
'^@public/(.*)': '<rootDir>/public/$1', | ||
'^@popup/(.*)': '<rootDir>/src/popup/$1', | ||
}, | ||
}; | ||
verbose: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
import crypto from 'crypto'; | ||
// Mocking crypto with Node webcrypto API. | ||
import { webcrypto } from 'crypto'; | ||
|
||
Object.assign(window, { | ||
crypto: { | ||
getRandomValues: (buffer: Int32Array) => { | ||
return crypto.randomFillSync(buffer); | ||
}, | ||
}, | ||
}); | ||
if (typeof crypto === 'undefined') { | ||
global.crypto = (webcrypto as unknown) as Crypto | ||
} |
Oops, something went wrong.