From b9a3bcbb5b75b615fc5cb1431d0235448e4709d7 Mon Sep 17 00:00:00 2001 From: Dominik Moritz Date: Wed, 29 Jan 2025 11:18:43 -0500 Subject: [PATCH] chore: copy stuff from embed --- .autorc.json | 11 ++----- eslint.config.mjs | 79 ++++++++++++++++++++++++----------------------- package-lock.json | 29 +++++++++++++++-- package.json | 11 +++---- rollup.config.mjs | 51 +++++++++++++++--------------- tsconfig.json | 7 ++--- 6 files changed, 102 insertions(+), 86 deletions(-) diff --git a/.autorc.json b/.autorc.json index 4c5acf08..4036e5e0 100644 --- a/.autorc.json +++ b/.autorc.json @@ -1,12 +1,5 @@ { - "plugins": [ - "npm", - "conventional-commits", - "first-time-contributor", - "released" - ], + "plugins": ["npm", "conventional-commits", "first-time-contributor", "released"], "baseBranch": "stable", - "prereleaseBranches": [ - "next" - ] + "prereleaseBranches": ["next"] } diff --git a/eslint.config.mjs b/eslint.config.mjs index a28e5919..71e66ee1 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,46 +1,44 @@ -import tseslint from "@typescript-eslint/eslint-plugin"; +import eslint from "@eslint/js"; +import tseslint from "typescript-eslint"; import tsParser from "@typescript-eslint/parser"; -import prettier from "eslint-plugin-prettier"; -import prettierConfig from "eslint-config-prettier"; +import prettierConfig from "eslint-plugin-prettier/recommended"; +import globals from "globals"; + +delete globals.browser["AudioWorkletGlobalScope "]; /** * @type {import('eslint').Linter.Config[]} */ export default [ { - ignores: ["build/**"], + ignores: ["prettier.config.js", "build/**", "coverage/**"], }, - prettierConfig, + eslint.configs.recommended, + ...tseslint.configs.recommendedTypeChecked, { - files: ["**/*.{js,ts}"], languageOptions: { - parser: tsParser, parserOptions: { - project: "./tsconfig.json", - sourceType: "module", + project: true, + tsconfigRootDir: import.meta.dirname, }, + }, + }, + { + files: ["**/*.{js,ts}"], + languageOptions: { + parser: tsParser, globals: { - window: false, - document: false, + ...globals.browser, }, }, - plugins: { - "@typescript-eslint": tseslint, - prettier: prettier, - }, rules: { - ...tseslint.configs.recommended.rules, "prettier/prettier": "warn", "@typescript-eslint/explicit-function-return-type": "off", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-use-before-define": "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/explicit-member-accessibility": "off", - "@typescript-eslint/explicit-module-boundary-types": "off", - "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": [ "error", { @@ -49,31 +47,36 @@ export default [ ignoreRestSiblings: true, }, ], - "no-shadow": "off", "@typescript-eslint/no-shadow": "error", - "@typescript-eslint/consistent-type-assertions": [ - "error", - { - assertionStyle: "as", - objectLiteralTypeAssertions: "allow-as-parameter", - }, - ], + "@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-irregular-whitespace": ["error", { skipComments: true }], "no-alert": "error", "prefer-const": "error", "no-return-assign": "error", "no-useless-call": "error", "no-useless-concat": "error", - "no-console": "off", - "no-undef": "off", - "no-unreachable": "off", + "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: ["**/*.mjs"], + ...tseslint.configs.disableTypeChecked, + }, ]; diff --git a/package-lock.json b/package-lock.json index 07aeffca..113a48bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,15 +14,14 @@ "@babel/plugin-transform-runtime": "^7.25.9", "@babel/preset-env": "^7.26.0", "@babel/preset-typescript": "^7.26.0", + "@eslint/js": "^9.19.0", "@release-it/conventional-changelog": "^9.0.2", "@rollup/plugin-json": "^6.1.0", "@rollup/plugin-node-resolve": "^16.0.0", "@rollup/plugin-terser": "^0.4.4", - "@typescript-eslint/eslint-plugin": "^8.22.0", - "@typescript-eslint/parser": "^8.22.0", "browser-sync": "^3.0.3", "concurrently": "^9.0.1", - "eslint": "^9.0.0", + "eslint": "^9.19.0", "eslint-config-prettier": "^10.0.1", "eslint-plugin-prettier": "^5.2.1", "gh-pages": "^6.2.0", @@ -33,6 +32,7 @@ "rollup-plugin-bundle-size": "^1.0.3", "rollup-plugin-ts": "^3.4.5", "typescript": "~5.3.3", + "typescript-eslint": "^8.22.0", "vega": "^5.30.0", "vega-lite": "^5.21.0" }, @@ -10442,6 +10442,29 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.22.0.tgz", + "integrity": "sha512-Y2rj210FW1Wb6TWXzQc5+P+EWI9/zdS57hLEc0gnyuvdzWo8+Y8brKlbj0muejonhMI/xAZCnZZwjbIfv1CkOw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.22.0", + "@typescript-eslint/parser": "8.22.0", + "@typescript-eslint/utils": "8.22.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, "node_modules/ua-parser-js": { "version": "1.0.39", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.39.tgz", diff --git a/package.json b/package.json index f74189fc..dfbee38a 100644 --- a/package.json +++ b/package.json @@ -65,31 +65,30 @@ "@babel/plugin-transform-runtime": "^7.25.9", "@babel/preset-env": "^7.26.0", "@babel/preset-typescript": "^7.26.0", + "@eslint/js": "^9.19.0", "@release-it/conventional-changelog": "^9.0.2", "@rollup/plugin-json": "^6.1.0", "@rollup/plugin-node-resolve": "^16.0.0", "@rollup/plugin-terser": "^0.4.4", - "@typescript-eslint/eslint-plugin": "^8.22.0", - "@typescript-eslint/parser": "^8.22.0", "browser-sync": "^3.0.3", "concurrently": "^9.0.1", - "eslint": "^9.0.0", + "eslint": "^9.19.0", "eslint-config-prettier": "^10.0.1", "eslint-plugin-prettier": "^5.2.1", "gh-pages": "^6.2.0", "prettier": "^3.3.3", "release-it": "^17.10.0", - "rollup": "^4.24.3", "rimraf": "^6.0.1", + "rollup": "^4.24.3", "rollup-plugin-bundle-size": "^1.0.3", "rollup-plugin-ts": "^3.4.5", "typescript": "~5.3.3", + "typescript-eslint": "^8.22.0", "vega": "^5.30.0", "vega-lite": "^5.21.0" }, "peerDependencies": { "vega": "*", "vega-lite": "*" - }, - "dependencies": {} + } } diff --git a/rollup.config.mjs b/rollup.config.mjs index d911ba74..22771aa3 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -1,10 +1,10 @@ -import json from '@rollup/plugin-json'; -import resolve from '@rollup/plugin-node-resolve'; -import terser from '@rollup/plugin-terser'; -import bundleSize from 'rollup-plugin-bundle-size'; -import ts from 'rollup-plugin-ts'; +import json from "@rollup/plugin-json"; +import resolve from "@rollup/plugin-node-resolve"; +import terser from "@rollup/plugin-terser"; +import bundleSize from "rollup-plugin-bundle-size"; +import ts from "rollup-plugin-ts"; -import pkg from './package.json' with { type: 'json' }; +import pkg from "./package.json" with { type: "json" }; const plugins = (browserslist, declaration) => [ resolve(), @@ -13,41 +13,42 @@ const plugins = (browserslist, declaration) => [ tsconfig: (resolvedConfig) => ({ ...resolvedConfig, declaration, - declarationMap: declaration + declarationMap: declaration, }), - transpiler: 'babel', - browserslist + transpiler: "babel", + browserslist, }), - bundleSize() + bundleSize(), ]; const outputs = [ { - input: 'src/index.ts', + input: "src/index.ts", output: { file: pkg.module, - format: 'esm' + format: "esm", }, - plugins: plugins(false, true) - }, { - input: 'src/index.ts', + plugins: plugins(false, true), + }, + { + input: "src/index.ts", output: [ { file: pkg.main, - format: 'umd', - name: 'vegaThemes', - exports: 'named' + format: "umd", + name: "vegaThemes", + exports: "named", }, { file: pkg.unpkg, - format: 'umd', - name: 'vegaThemes', - exports: 'named', - plugins: [terser()] - } + format: "umd", + name: "vegaThemes", + exports: "named", + plugins: [terser()], + }, ], - plugins: plugins('defaults', false), - } + plugins: plugins("defaults", false), + }, ]; export default outputs; diff --git a/tsconfig.json b/tsconfig.json index 364a7b68..ffbdd5c2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,8 +10,5 @@ "importHelpers": true, "resolveJsonModule": true }, - "include": [ - "src/**/*.ts", - "test/**/*.ts" - ] -} \ No newline at end of file + "include": ["src/**/*.ts", "test/**/*.ts"] +}