-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(core) most files ported to typescript * chore(core) fix linter * chore(core) more types * chore(core) fix ESM index imports * chore(core) fix test types * chore(react) add ts eslint ts rules * chore: update gh test action * chore: remove gl * chore: add test-ci * chore: fix most strict type checks * chore: dont build examples, fix lint * chore: work on test imports * chore: export types and fix get-started * chore: remove webpack and babel * chore: work on standalone bundle * chore: ignore root deps * chore: fix test runner (but not all tests) * chore: fix tests * chore: coverage --------- Signed-off-by: Chris Gervang <[email protected]>
- Loading branch information
1 parent
8b9e1b1
commit bb024d8
Showing
171 changed files
with
9,356 additions
and
9,169 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
dist/ | ||
test/ | ||
node_modules/ | ||
dist.*.js | ||
*.min.js | ||
|
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,130 @@ | ||
const {getESLintConfig} = require('ocular-dev-tools/configuration'); | ||
|
||
const config = getESLintConfig({ | ||
react: '16.13.1', | ||
overrides: { | ||
parser: '', | ||
parserOptions: { | ||
project: ['./tsconfig.json'], | ||
ecmaVersion: 2020 | ||
}, | ||
extends: ['prettier'], | ||
env: { | ||
es2020: true | ||
// browser: true, | ||
// node: true | ||
}, | ||
|
||
rules: { | ||
camelcase: 0, | ||
indent: 0, | ||
'import/no-unresolved': 0, | ||
'import/no-extraneous-dependencies': 0, // ['warn'], | ||
'no-console': 1, | ||
'no-continue': ['warn'], | ||
'callback-return': 0, | ||
'max-depth': ['warn', 4], | ||
complexity: ['warn'], | ||
'max-statements': ['warn'], | ||
'default-case': ['warn'], | ||
'no-eq-null': ['warn'], | ||
eqeqeq: ['warn'], | ||
radix: 0, | ||
'arrow-parens': ['error', 'as-needed'], // TODO: Remove later | ||
// 'accessor-pairs': ['error', {getWithoutSet: false, setWithoutGet: false}] | ||
}, | ||
|
||
overrides: [ | ||
{ | ||
files: ['**/*.js', '**/*.ts', '**/*.tsx', '**/*.d.ts'], | ||
rules: { | ||
indent: 0, | ||
// Gradually enable | ||
'@typescript-eslint/ban-ts-comment': 0, | ||
'@typescript-eslint/ban-types': 0, | ||
'@typescript-eslint/no-unsafe-member-access': 0, | ||
'@typescript-eslint/no-unsafe-assignment': 0, | ||
'@typescript-eslint/no-var-requires': 0, | ||
'@typescript-eslint/no-unused-vars': [ | ||
'warn', | ||
{vars: 'all', args: 'none', ignoreRestSiblings: false} | ||
], | ||
'@typescript-eslint/unbound-method': 0, | ||
// We still have some issues with import resolution | ||
'import/named': 0, | ||
// Warn instead of error | ||
// 'max-params': ['warn'], | ||
// 'no-undef': ['warn'], | ||
// camelcase: ['warn'], | ||
// '@typescript-eslint/no-floating-promises': ['warn'], | ||
// '@typescript-eslint/await-thenable': ['warn'], | ||
// '@typescript-eslint/no-misused-promises': ['warn'], | ||
'@typescript-eslint/no-empty-function': 0, | ||
// We use function hoisting | ||
'@typescript-eslint/no-use-before-define': 0, | ||
// We always want explicit typing, e.g `field: string = ''` | ||
'@typescript-eslint/no-inferrable-types': 0, | ||
'@typescript-eslint/restrict-template-expressions': 0, | ||
'@typescript-eslint/explicit-module-boundary-types': 0, | ||
'@typescript-eslint/require-await': 0, | ||
'@typescript-eslint/no-unsafe-return': 0, | ||
'@typescript-eslint/no-unsafe-call': 0, | ||
'@typescript-eslint/no-empty-interface': 0, | ||
'@typescript-eslint/restrict-plus-operands': 0 | ||
} | ||
}, | ||
// tests are run with aliases set up in node and webpack. | ||
// This means lint will not find the imported files and generate false warnings | ||
{ | ||
// scripts use devDependencies | ||
files: [ | ||
'**/test/**/*.js', | ||
'**/test/**/*.ts', | ||
'**/scripts/**/*.js', | ||
'*.config.js', | ||
'*.config.local.js', | ||
'*.config.local.mjs' | ||
], | ||
globals: { | ||
process: true | ||
}, | ||
rules: { | ||
'import/no-unresolved': 0, | ||
'import/no-extraneous-dependencies': 0, | ||
'no-process-env': 0 | ||
} | ||
}, | ||
{ | ||
files: ['*.spec.js', 'webpack.config.js', '**/bundle/*.js'], | ||
rules: { | ||
'import/no-extraneous-dependencies': 0 | ||
} | ||
} | ||
], | ||
|
||
settings: { | ||
// Ensure eslint finds typescript files | ||
'import/resolver': { | ||
node: { | ||
extensions: ['.js', '.jsx', '.mjs', '.ts', '.tsx'] | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
|
||
// Uncomment to log the eslint config | ||
// console.debug(config); | ||
|
||
module.exports = config; | ||
|
||
// rules: { | ||
// 'guard-for-in': 0, | ||
// 'no-inline-comments': 0, | ||
// camelcase: 0, | ||
// 'react/forbid-prop-types': 0, | ||
// 'react/no-deprecated': 0, | ||
// 'import/no-unresolved': ['error', {ignore: ['test']}], | ||
// 'import/no-extraneous-dependencies': ['error', {devDependencies: false, peerDependencies: true}], | ||
// // 'accessor-pairs': ['error', {getWithoutSet: false, setWithoutGet: false}], | ||
// }, |
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
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,26 +1,46 @@ | ||
// eslint-disable-next-line no-unused-vars | ||
const {resolve} = require('path'); | ||
/** @typedef {import('ocular-dev-tools').OcularConfig} OcularConfig */ | ||
import {dirname, join} from 'path'; | ||
import {fileURLToPath} from 'url'; | ||
|
||
module.exports = { | ||
const packageRoot = dirname(fileURLToPath(import.meta.url)); | ||
|
||
/** @type {OcularConfig} */ | ||
const config = { | ||
lint: { | ||
paths: ['docs', 'modules', 'examples', 'test'], | ||
extensions: ['js'] | ||
paths: ['modules', 'test'] | ||
// paths: ['modules', 'test', 'examples', 'website'] | ||
}, | ||
|
||
babel: false, | ||
|
||
bundle: { | ||
globalName: 'hubble', | ||
target: ['chrome110', 'firefox110', 'safari15'], | ||
format: 'umd', | ||
globals: { | ||
'@hubble.gl/*': 'globalThis.hubble' | ||
} | ||
}, | ||
|
||
// aliases: { | ||
// // TEST | ||
// test: resolve(__dirname, './test') | ||
// }, | ||
typescript: { | ||
project: 'tsconfig.build.json' | ||
}, | ||
|
||
aliases: { | ||
'hubble.gl-test': join(packageRoot, './test') | ||
}, | ||
|
||
browserTest: { | ||
server: {wait: 5000} | ||
coverage: { | ||
test: 'browser' | ||
}, | ||
|
||
entry: { | ||
test: 'test/node.js', | ||
'test-browser': 'test/browser.js', | ||
bench: 'test/bench/node.js', | ||
'bench-browser': 'test/bench/browser.js', | ||
size: 'test/size/main.js' | ||
test: 'test/node.ts', | ||
'test-browser': 'index.html', | ||
// bench: 'test/bench/index.js', | ||
// 'bench-browser': 'test/bench/browser.html', | ||
size: 'test/size/import-nothing.js' | ||
} | ||
}; | ||
|
||
export default config; |
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,8 +1,9 @@ | ||
node_modules/ | ||
**/dist*/**/*.js | ||
website/build | ||
**/dist*/**/* | ||
dist.js | ||
*.min.js | ||
*.md | ||
|
||
public/ | ||
.cache/ | ||
.cache/ | ||
.docusaurus |
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
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
Oops, something went wrong.