Skip to content

Commit

Permalink
feat!: esm only package
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Feb 11, 2025
1 parent 9325b67 commit 000c5d5
Show file tree
Hide file tree
Showing 10 changed files with 635 additions and 526 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

66 changes: 0 additions & 66 deletions .eslintrc.js

This file was deleted.

15 changes: 0 additions & 15 deletions .prettierrc.json

This file was deleted.

92 changes: 92 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import tsParser from '@typescript-eslint/parser';
import prettierConfig from 'eslint-plugin-prettier/recommended';
import globals from 'globals';
import vitest from 'eslint-plugin-vitest';

delete globals.browser['AudioWorkletGlobalScope '];

/**
* @type {import('eslint').Linter.Config[]}
*/
export default [
{
ignores: ['build/**', 'coverage/**'],
},
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
project: './tsconfig.eslint.json',
tsconfigRootDir: import.meta.dirname,
},
},
},
{
files: ['**/*.ts'],
plugins: {
vitest,
},
languageOptions: {
parser: tsParser,
globals: {
...globals.browser,
},
},
settings: {
vitest: {
typecheck: true,
},
},
rules: {
...vitest.configs.recommended.rules,
'prettier/prettier': 'warn',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: true,
},
],
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-object-literal-type-assertion': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/no-base-to-string': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'linebreak-style': ['error', 'unix'],
'no-irregular-whitespace': ['error', {skipComments: true}],
'no-alert': 'error',
'prefer-const': 'error',
'no-return-assign': 'error',
'no-useless-call': 'error',
'no-useless-concat': 'error',
'prefer-template': 'error',
'no-unused-vars': 'off',
// "no-undef": "off", // typescript takes care of this for us
'no-unreachable': 'off', // typescript takes care of this for us
},
},
prettierConfig,
{
files: ['**/*.js'],
...tseslint.configs.disableTypeChecked,
},
];
39 changes: 18 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
"chart",
"visualization"
],
"main": "build/vega-lite.js",
"unpkg": "build/vega-lite.min.js",
"jsdelivr": "build/vega-lite.min.js",
"module": "build/src/index",
"types": "build/src/index.d.ts",
"type": "module",
"exports": {
"types": "./build/index.d.ts",
"default": "./build/index.js"
},
"unpkg": "build/vega-embed.min.js",
"jsdelivr": "build/vega-embed.min.js",
"bin": {
"vl2pdf": "./bin/vl2pdf",
"vl2png": "./bin/vl2png",
Expand All @@ -37,7 +39,7 @@
"changelog": "conventional-changelog -p angular -r 2",
"prebuild": "yarn clean:build",
"build": "yarn build:only",
"build:only": "tsc -p tsconfig.build.json && rollup -c",
"build:only": "rollup -c",
"prebuild:examples": "yarn build:only",
"build:examples": "yarn data && TZ=America/Los_Angeles scripts/build-examples.sh",
"prebuild:examples-full": "yarn build:only",
Expand Down Expand Up @@ -79,45 +81,42 @@
"url": "https://github.com/vega/vega-lite/issues"
},
"devDependencies": {
"@babel/core": "^7.26.7",
"@babel/preset-env": "^7.26.7",
"@babel/preset-typescript": "^7.26.0",
"@release-it/conventional-changelog": "^10.0.0",
"@rollup/plugin-alias": "^5.1.1",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^28.0.2",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^16.0.0",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.2",
"@types/d3": "^7.4.3",
"@types/jest": "^29.5.14",
"@types/node": "^22.12.0",
"@types/node": "^22.13.1",
"@types/pako": "^2.0.3",
"@typescript-eslint/eslint-plugin": "^7.17.0",
"@typescript-eslint/parser": "^7.17.0",
"@typescript-eslint/eslint-plugin": "^8.24.0",
"@typescript-eslint/parser": "^8.24.0",
"ajv": "^8.17.1",
"ajv-formats": "^3.0.1",
"cheerio": "^1.0.0",
"conventional-changelog-cli": "^5.0.0",
"d3": "^7.9.0",
"del-cli": "^6.0.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint": "^9.20.1",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-jest": "^28.11.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-prettier": "^5.2.3",
"fast-json-stable-stringify": "~2.1.0",
"highlight.js": "^11.11.1",
"jest": "^29.7.0",
"jest-dev-server": "^11.0.0",
"mkdirp": "^3.0.1",
"pako": "^2.1.0",
"prettier": "^3.4.2",
"prettier": "^3.5.0",
"puppeteer": "^15.0.0",
"release-it": "18.1.2",
"rollup": "^4.32.1",
"rollup": "^4.34.6",
"rollup-plugin-bundle-size": "^1.0.3",
"serve": "^14.2.4",
"terser": "^5.37.0",
"terser": "^5.38.2",
"ts-jest": "^29.2.5",
"ts-json-schema-generator": "^2.3.0",
"typescript": "~5.7.3",
Expand All @@ -133,8 +132,6 @@
"vega-event-selector": "~3.0.1",
"vega-expression": "~5.1.2",
"vega-util": "~1.17.3",
"vega-expression": "~5.1.2",
"vega-util": "~1.17.3",
"yargs": "~17.7.2"
},
"peerDependencies": {
Expand Down
21 changes: 21 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* @see https://prettier.io/docs/en/configuration.html
* @type {import("prettier").Config}
*/
const config = {
printWidth: 120,
proseWrap: 'never',
overrides: [
{
files: '*.{js,jsx,ts,tsx}',
options: {
bracketSpacing: false,
singleQuote: true,
arrowParens: 'avoid',
trailingComma: 'none',
},
},
],
};

export default config;
Loading

0 comments on commit 000c5d5

Please sign in to comment.