diff --git a/.gitignore b/.gitignore index 15f55e62..9b1736dd 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,6 @@ es dist public type-declarations -style .vscode coverage dev-build \ No newline at end of file diff --git a/eslint.config.mjs b/eslint.config.mjs index b79dd6ac..756bd94f 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -15,83 +15,112 @@ const compat = new FlatCompat({ allConfig: js.configs.all }); -export default [{ - ignores: ["examples/webpack.dev.js", "**/.eslintrc.js", "**/babel.config.js"], -}, ...compat.extends("plugin:@typescript-eslint/recommended", "plugin:react/recommended"), { - plugins: { - "@typescript-eslint": typescriptEslint, - react, +export default [ + { + ignores: [ + "examples/webpack.dev.js", + "**/.eslintrc.js", + "**/babel.config.js", + "src/style/**", + "**/*.css", + ], }, - - languageOptions: { - globals: { - ...globals.mocha, - ...globals.browser, + ...compat.extends( + "plugin:@typescript-eslint/recommended", + "plugin:react/recommended" + ), + { + plugins: { + "@typescript-eslint": typescriptEslint, + react, }, - parser: tsParser, - ecmaVersion: 5, - sourceType: "script", + languageOptions: { + globals: { + ...globals.mocha, + ...globals.browser, + }, + + parser: tsParser, + ecmaVersion: 5, + sourceType: "script", - parserOptions: { - project: ["./tsconfig.json", "./src/visGeometry/workers/tsconfig.json"], + parserOptions: { + project: [ + "./tsconfig.json", + "./src/visGeometry/workers/tsconfig.json", + ], + }, }, - }, - settings: { - react: { - version: "detect", + settings: { + react: { + version: "detect", + }, }, - }, - rules: { - "@typescript-eslint/no-empty-object-type": ["warn"], - "@typescript-eslint/no-unsafe-function-type": ["warn"], - "@typescript-eslint/no-wrapper-object-types": ["warn"], + rules: { + "@typescript-eslint/no-empty-object-type": ["warn"], + "@typescript-eslint/no-unsafe-function-type": ["warn"], + "@typescript-eslint/no-wrapper-object-types": ["warn"], - "@typescript-eslint/naming-convention": ["warn", { - selector: "default", - format: ["camelCase", "PascalCase"], - }, { - selector: "variable", - format: ["camelCase", "UPPER_CASE", "PascalCase"], - }, { - selector: "property", - format: ["camelCase", "UPPER_CASE"], - leadingUnderscore: "allow", - }, { - selector: "property", - format: null, - filter: { - regex: "^[0-9]+$", - match: true, - } - }, { - selector: "typeLike", - format: ["PascalCase"], - }, { - selector: "interface", - format: ["PascalCase"], - }, { - selector: "enumMember", - format: ["UPPER_CASE"], - }, { - selector: "parameter", - format: ["camelCase"], - leadingUnderscore: "allow", - }], + "@typescript-eslint/naming-convention": [ + "warn", + { + selector: "default", + format: ["camelCase", "PascalCase"], + }, + { + selector: "variable", + format: ["camelCase", "UPPER_CASE", "PascalCase"], + }, + { + selector: "property", + format: ["camelCase", "UPPER_CASE"], + leadingUnderscore: "allow", + }, + { + selector: "property", + format: null, + filter: { + regex: "^[0-9]+$", + match: true, + }, + }, + { + selector: "typeLike", + format: ["PascalCase"], + }, + { + selector: "interface", + format: ["PascalCase"], + }, + { + selector: "enumMember", + format: ["UPPER_CASE"], + }, + { + selector: "parameter", + format: ["camelCase"], + leadingUnderscore: "allow", + }, + ], - "@typescript-eslint/indent": ["off"], - "@typescript-eslint/no-empty-function": ["warn"], - "@typescript-eslint/no-inferrable-types": ["warn"], - "@typescript-eslint/no-this-alias": ["warn"], - "prefer-const": ["warn"], - "prefer-spread": ["warn"], - "no-var": ["warn"], - "no-unused-vars": "off", + "@typescript-eslint/indent": ["off"], + "@typescript-eslint/no-empty-function": ["warn"], + "@typescript-eslint/no-inferrable-types": ["warn"], + "@typescript-eslint/no-this-alias": ["warn"], + "prefer-const": ["warn"], + "prefer-spread": ["warn"], + "no-var": ["warn"], + "no-unused-vars": "off", - "@typescript-eslint/no-unused-vars": ["warn", { - argsIgnorePattern: "^_", - }], + "@typescript-eslint/no-unused-vars": [ + "warn", + { + argsIgnorePattern: "^_", + }, + ], + }, }, -}]; \ No newline at end of file +]; \ No newline at end of file diff --git a/package.json b/package.json index cb8aefaa..af453cb3 100644 --- a/package.json +++ b/package.json @@ -9,15 +9,16 @@ "scripts": { "start": "run-p 'processCSS -- --watch' 'transpileES -- --watch' 'generateTypes -- --watch' serve-example", "dev": "npm install && npm run build && npm run install-examples && npm run start", + "pack-dev": "npm run build && npm run copy-build && cd dev-build && npm pack", "serve-example": "cd examples && npm run serve-example", "install-examples": "npm install && cd examples && npm install", "build": "npm-run-all generateTypes transpileES processCSS", "generateTypes": "tsc -p tsconfig.base.json --emitDeclarationOnly", "transpileES": "cross-env TS_NODE_PROJECT=tsconfig.es.json BABEL_ENV=es babel src --out-dir es --extensions .ts,.tsx,.js,.jsx --ignore 'src/test'", - "processCSS": "postcss src/viewport/index.css --output es/style/style.css", - "copy-build": "copyfiles 'es/**/*' style/* 'type-declarations/**/*' package.json README.md dev-build", + "processCSS": "postcss src/style/style.css --output es/style/style.css", + "copy-build": "copyfiles 'es/**/*' 'type-declarations/**/*' package.json README.md dev-build", "gh-build": "npm run processCSS && cd examples && npm run build-example", - "lint": "eslint src/**", + "lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'", "test": "vitest run", "coverage": "vitest run --coverage", "typeCheck": "tsc -p tsconfig.json --noEmit", @@ -28,7 +29,6 @@ }, "files": [ "es", - "style", "type-declarations", "README.md", "package.json" diff --git a/src/index.ts b/src/index.ts index d44f2aee..faa388d8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,5 @@ import Viewport from "./viewport/index.js"; +import "./style/style.css"; export type { SelectionStateInfo, diff --git a/src/viewport/index.css b/src/style/style.css similarity index 100% rename from src/viewport/index.css rename to src/style/style.css