-
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: add eslint and fixes it wanted (its a start)
- Loading branch information
1 parent
d1b107d
commit 466c537
Showing
11 changed files
with
4,484 additions
and
3,609 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,24 @@ | ||
const path = require('path'); | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'], | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: 'module', | ||
project: './tsconfig.eslint.json', | ||
tsconfigRootDir: './', | ||
warnOnUnsupportedTypeScriptVersion: false | ||
}, | ||
rules: { | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/no-inferrable-types': 'off', | ||
'prettier/prettier': [ | ||
'error', | ||
{ | ||
endOfLine: 'auto' | ||
} | ||
] | ||
} | ||
}; |
Large diffs are not rendered by default.
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 |
---|---|---|
@@ -1,54 +1,62 @@ | ||
{ | ||
"name": "custom-elements-hmr-polyfill", | ||
"version": "1.0.0", | ||
"description": "Custom Elements HMR polyfill", | ||
"main": "dist/CommonJS/index.js", | ||
"module": "dist/ES6/index.js", | ||
"typings": "dist/CommonJS/index.d.ts", | ||
"scripts": { | ||
"prebootstrap": "npx st-rm-rf ./node_modules package-lock.json", | ||
"bootstrap": "npm i", | ||
"start": "node fuse", | ||
"watch": "node fuse", | ||
"build": "node fuse build && npm run rollup", | ||
"rollup": "./node_modules/.bin/rollup -c", | ||
"prettier:run": "node ./node_modules/prettier/bin-prettier --write \"src/**/*.{json,md,ts}\" ", | ||
"test": "todo" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/vegarringdal/custom-elements-hmr-polyfill.git" | ||
}, | ||
"author": "Vegar Ringdal<[email protected]> & Aron Homberg<[email protected]>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/vegarringdal/custom-elements-hmr-polyfill/issues" | ||
}, | ||
"homepage": "https://github.com/vegarringdal/custom-elements-hmr-polyfill#readme", | ||
"devDependencies": { | ||
"fuse-box": "4.0.0-next.425", | ||
"fuse-box-typechecker": "^3.0.0-next.31", | ||
"husky": "^4.2.5", | ||
"lint-staged": "^10.1.3", | ||
"prettier": "^2.0.4", | ||
"rollup": "^2.6.1", | ||
"rollup-plugin-terser": "^5.3.0", | ||
"tslib": "^1.11.1", | ||
"typescript": "^3.8.3", | ||
"@commitlint/cli": "^8.3.5", | ||
"@commitlint/config-conventional": "^8.3.4" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged", | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" | ||
} | ||
}, | ||
"lint-staged": { | ||
"src/**/*.{json,md,ts}": [ | ||
"prettier --write", | ||
"git add" | ||
] | ||
}, | ||
"dependencies": {} | ||
"name": "custom-elements-hmr-polyfill", | ||
"version": "1.0.0", | ||
"description": "Custom Elements HMR polyfill", | ||
"main": "dist/CommonJS/index.js", | ||
"module": "dist/ES6/index.js", | ||
"typings": "dist/CommonJS/index.d.ts", | ||
"scripts": { | ||
"prebootstrap": "npx st-rm-rf ./node_modules package-lock.json", | ||
"bootstrap": "npm i", | ||
"start": "node fuse", | ||
"watch": "node fuse", | ||
"build": "node fuse build && npm run rollup", | ||
"rollup": "./node_modules/.bin/rollup -c", | ||
"prettier:run": "node ./node_modules/prettier/bin-prettier --write \"src/**/*.{json,md,ts}\" ", | ||
"eslint": "npm run eslint:run:package && npm run eslint:run:sample", | ||
"eslint:run:package": "./node_modules/.bin/eslint --fix ./src/package/**/*.ts", | ||
"eslint:run:sample": "./node_modules/.bin/eslint --fix ./src/sample/**/*.ts", | ||
"test": "todo" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/vegarringdal/custom-elements-hmr-polyfill.git" | ||
}, | ||
"author": "Vegar Ringdal<[email protected]> & Aron Homberg<[email protected]>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/vegarringdal/custom-elements-hmr-polyfill/issues" | ||
}, | ||
"homepage": "https://github.com/vegarringdal/custom-elements-hmr-polyfill#readme", | ||
"devDependencies": { | ||
"fuse-box": "4.0.0-next.425", | ||
"fuse-box-typechecker": "^3.0.0-next.31", | ||
"husky": "^4.2.5", | ||
"lint-staged": "^10.1.3", | ||
"prettier": "^2.0.4", | ||
"rollup": "^2.6.1", | ||
"rollup-plugin-terser": "^5.3.0", | ||
"tslib": "^1.11.1", | ||
"typescript": "^3.8.3", | ||
"@commitlint/cli": "^8.3.5", | ||
"@commitlint/config-conventional": "^8.3.4", | ||
"@typescript-eslint/eslint-plugin": "^2.27.0", | ||
"@typescript-eslint/parser": "^2.27.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.10.1", | ||
"eslint-plugin-prettier": "^3.1.2" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged", | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" | ||
} | ||
}, | ||
"lint-staged": { | ||
"src/**/*.{json,md,ts}": [ | ||
"prettier --write", | ||
"git add" | ||
] | ||
}, | ||
"dependencies": {} | ||
} |
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,43 +1,45 @@ | ||
export function initCache() { | ||
if (!(<any>globalThis).hmrCache) { | ||
(<any>globalThis).hmrCache = {}; | ||
(<any>globalThis).hmrCacheSymbolAttributes = {}; | ||
(<any>globalThis).hmrCacheSymbolObserver = {}; | ||
if (!(globalThis as any).hmrCache) { | ||
(globalThis as any).hmrCache = {}; | ||
(globalThis as any).hmrCacheSymbolAttributes = {}; | ||
(globalThis as any).hmrCacheSymbolObserver = {}; | ||
} | ||
} | ||
|
||
export function getMostRecentImpl(elementName: string) { | ||
return (<any>globalThis).hmrCache[elementName]; | ||
return (globalThis as any).hmrCache[elementName]; | ||
} | ||
|
||
export function setMostRecentImpl(elementName: string, impl: any) { | ||
(<any>globalThis).hmrCache[elementName] = impl; | ||
(globalThis as any).hmrCache[elementName] = impl; | ||
} | ||
|
||
export function isCacheInitialized() { | ||
return (<any>globalThis).hmrCache.initialized; | ||
return (globalThis as any).hmrCache.initialized; | ||
} | ||
|
||
export function setCacheAsInitialized() { | ||
(<any>globalThis).hmrCache.initialized = true; | ||
(globalThis as any).hmrCache.initialized = true; | ||
} | ||
|
||
export function getSymbolAttributes(elementName: string) { | ||
if (!(<any>globalThis).hmrCacheSymbolAttributes[elementName]) { | ||
(<any>globalThis).hmrCacheSymbolAttributes[elementName] = Symbol('observedAttributesArray'); | ||
return (<any>globalThis).hmrCacheSymbolAttributes[elementName]; | ||
if (!(globalThis as any).hmrCacheSymbolAttributes[elementName]) { | ||
(globalThis as any).hmrCacheSymbolAttributes[elementName] = Symbol( | ||
'observedAttributesArray' | ||
); | ||
return (globalThis as any).hmrCacheSymbolAttributes[elementName]; | ||
} else { | ||
return (<any>globalThis).hmrCacheSymbolAttributes[elementName]; | ||
return (globalThis as any).hmrCacheSymbolAttributes[elementName]; | ||
} | ||
} | ||
|
||
export function getSymbolObserver(elementName: string) { | ||
if (!(<any>globalThis).hmrCacheSymbolObserver[elementName]) { | ||
(<any>globalThis).hmrCacheSymbolObserver[elementName] = Symbol( | ||
if (!(globalThis as any).hmrCacheSymbolObserver[elementName]) { | ||
(globalThis as any).hmrCacheSymbolObserver[elementName] = Symbol( | ||
'observedAttributesObserver' | ||
); | ||
return (<any>globalThis).hmrCacheSymbolObserver[elementName]; | ||
return (globalThis as any).hmrCacheSymbolObserver[elementName]; | ||
} else { | ||
return (<any>globalThis).hmrCacheSymbolObserver[elementName]; | ||
return (globalThis as any).hmrCacheSymbolObserver[elementName]; | ||
} | ||
} |
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,4 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"exclude": ["node_modules"] | ||
} |