diff --git a/.eslintrc.js b/.eslintrc.js index 3449a5942..ffe2ada25 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,90 +1,38 @@ -const {getESLintConfig, deepMerge} = require('ocular-dev-tools'); +const {getESLintConfig} = require('ocular-dev-tools/configuration'); -const defaultConfig = getESLintConfig({react: '16.8.2'}); +module.exports = getESLintConfig({ + react: '16.8.2', + overrides: { + parserOptions: { + project: ['./tsconfig.json'], + ecmaVersion: 2020 + }, -// Make any changes to default config here -const config = deepMerge(defaultConfig, { - parserOptions: { - project: ['./tsconfig.json'], - ecmaVersion: 2020 - }, + rules: { + 'max-depth': ['warn', 4], + complexity: ['warn'], + 'max-statements': ['warn'], + 'callback-return': 0 + }, - 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 - // 'accessor-pairs': ['error', {getWithoutSet: false, setWithoutGet: false}] - }, - - overrides: [ - { - files: ['**/*.ts', '**/*.tsx', '**/*.d.ts'], - rules: { - indent: 0, - quotes: ['error', 'single', {avoidEscape: true}], - // For parquet module - '@typescript-eslint/no-non-null-assertion': 0, - '@typescript-eslint/no-non-null-asserted-optional-chain': 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} - ], - // 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': ['warn', {allow: ['arrowFunctions']}], - // 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 + overrides: [ + { + files: ['**/*.ts', '**/*.tsx', '**/*.d.ts'], + rules: { + // 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, + 'import/named': 0, + '@typescript-eslint/no-empty-function': ['warn', {allow: ['arrowFunctions']}], + '@typescript-eslint/restrict-template-expressions': 0, + '@typescript-eslint/explicit-module-boundary-types': 0, + '@typescript-eslint/no-unsafe-return': 0, + '@typescript-eslint/no-unsafe-call': 0, + '@typescript-eslint/restrict-plus-operands': 0 + } } - } - ], - - settings: { - // Ensure eslint finds typescript files - 'import/resolver': { - node: { - extensions: ['.js', '.jsx', '.mjs', '.ts', '.tsx'] - } - } + ] } }); - -module.exports = config; diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 586594ed1..c639c86a2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v1 with: - node-version: '12.x' + node-version: '16.x' - name: Publish release run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6d903a795..548694819 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest env: - MapboxAccessToken: ${{ secrets.MAPBOX_ACCESS_TOKEN_CI }} + VITE_MAPBOX_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN_CI }} steps: - uses: actions/checkout@v2.1.1 @@ -20,7 +20,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v1 with: - node-version: '14.x' + node-version: '16.x' - name: Install dependencies run: | diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 289c909f3..fc0361097 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -20,7 +20,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v1 with: - node-version: '14.x' + node-version: '16.x' - name: Get version id: get-version diff --git a/.ocularrc.js b/.ocularrc.js index 3fa38e5a7..06755746d 100644 --- a/.ocularrc.js +++ b/.ocularrc.js @@ -5,6 +5,10 @@ const config = { paths: ['src', 'test', 'examples'] }, + typescript: { + project: 'tsconfig.json' + }, + aliases: { 'react-map-gl/test': resolve('./test'), 'react-map-gl': resolve('./src') @@ -17,7 +21,7 @@ const config = { entry: { test: 'test/node.js', 'test-browser': 'test/browser.js', - size: 'test/size/import-nothing.js' + size: ['test/size/all.js', 'test/size/map.js'] } }; diff --git a/babel.config.js b/babel.config.js index deb0ca239..9ac8e98ab 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,8 +1,6 @@ -/* eslint-disable import/no-extraneous-dependencies */ -const {getBabelConfig} = require('ocular-dev-tools'); +const {getBabelConfig} = require('ocular-dev-tools/configuration'); -module.exports = api => { - let config = getBabelConfig(api, {react: true}); - - return config; -}; +module.exports = getBabelConfig({ + react: true, + overrides: {} +}); diff --git a/index.html b/index.html index 29779ad69..bde3278c6 100644 --- a/index.html +++ b/index.html @@ -5,6 +5,6 @@