diff --git a/eslint.config.mjs b/eslint.config.mjs index a8dbc43..fc49cea 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,12 +1,21 @@ // @ts-check import eslint from '@eslint/js'; +import eslintConfigPackageJson from 'eslint-plugin-package-json/configs/recommended'; import eslintConfigPrettier from 'eslint-config-prettier'; import eslintPluginJest from 'eslint-plugin-jest'; import * as eslintPluginJestFormatting from 'eslint-plugin-jest-formatting'; import eslintPluginUnicorn from 'eslint-plugin-unicorn'; import typescriptEslint from 'typescript-eslint'; +/** @type import('@typescript-eslint/utils').TSESLint.SharedConfig.RulesRecord */ +const disabledTypeScriptEslintRules = Object.fromEntries( + typescriptEslint.configs.all + .flatMap((config) => Object.keys(config.rules ?? [])) + .filter((ruleName) => ruleName.startsWith('@typescript-eslint/')) + .map((ruleName) => [ruleName, 'off']), +); + export default typescriptEslint.config( eslint.configs.recommended, ...typescriptEslint.configs.strictTypeChecked, @@ -105,7 +114,17 @@ export default typescriptEslint.config( '@typescript-eslint/switch-exhaustiveness-check': 'error', }, }, - { ignores: ['**/*.json', 'node_modules', 'dist'] }, + { ignores: ['**/!(package).json', 'node_modules', 'dist'] }, + { + // disable all TypeScript-related rules because they interfere with JSON parsing + files: ['**/package.json'], + languageOptions: eslintConfigPackageJson.languageOptions, + plugins: eslintConfigPackageJson.plugins, + rules: { + ...disabledTypeScriptEslintRules, + ...eslintConfigPackageJson.rules, + }, + }, { files: ['eslint.config.mjs'], rules: { diff --git a/package-lock.json b/package-lock.json index 8a48b1f..f0178a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "eslint-config-prettier": "^9.1.0", "eslint-plugin-jest": "^28.5.0", "eslint-plugin-jest-formatting": "^3.1.0", + "eslint-plugin-package-json": "^0.14.0", "eslint-plugin-unicorn": "^53.0.0", "jest": "^29.7.0", "jest-extended": "^4.0.2", @@ -1564,6 +1565,16 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==", + "dev": true, + "dependencies": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, "node_modules/@types/graceful-fs": { "version": "4.1.6", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", @@ -1597,6 +1608,12 @@ "@types/istanbul-lib-report": "*" } }, + "node_modules/@types/minimatch": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", + "dev": true + }, "node_modules/@types/node": { "version": "20.4.2", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz", @@ -2554,6 +2571,15 @@ "node": ">=0.10.0" } }, + "node_modules/detect-indent": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.1.0.tgz", + "integrity": "sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -2781,6 +2807,28 @@ "eslint": ">=0.8.0" } }, + "node_modules/eslint-plugin-package-json": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-package-json/-/eslint-plugin-package-json-0.14.0.tgz", + "integrity": "sha512-/Ls/KMVAEy4n5fXSEyj3GpfzLm9R1ErI9PrIBJwvuLRNbW3+1m7JWvkjgsBy2tmNfhtMhCGodhRDK2CN7Y4ADw==", + "dev": true, + "dependencies": { + "detect-indent": "6.1.0", + "detect-newline": "3.1.0", + "package-json-validator": "^0.6.3", + "semver": "^7.5.4", + "sort-object-keys": "^1.1.3", + "sort-package-json": "^1.57.0", + "validate-npm-package-name": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "eslint": ">=8.0.0", + "jsonc-eslint-parser": "^2.0.0" + } + }, "node_modules/eslint-plugin-unicorn": { "version": "53.0.0", "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-53.0.0.tgz", @@ -3243,6 +3291,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/git-hooks-list": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/git-hooks-list/-/git-hooks-list-1.0.3.tgz", + "integrity": "sha512-Y7wLWcrLUXwk2noSka166byGCvhMtDRpgHdzCno1UQv/n/Hegp++a2xBWJL1lJarnKD3SWaljD+0z1ztqxuKyQ==", + "dev": true, + "funding": { + "url": "https://github.com/fisker/git-hooks-list?sponsor=1" + } + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -3541,6 +3598,15 @@ "node": ">=8" } }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -4288,6 +4354,25 @@ "node": ">=6" } }, + "node_modules/jsonc-eslint-parser": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/jsonc-eslint-parser/-/jsonc-eslint-parser-2.4.0.tgz", + "integrity": "sha512-WYDyuc/uFcGp6YtM2H0uKmUwieOuzeE/5YocFJLnLfclZ4inf3mRn8ZVy1s7Hxji7Jxm6Ss8gqpexD/GlKoGgg==", + "dev": true, + "peer": true, + "dependencies": { + "acorn": "^8.5.0", + "eslint-visitor-keys": "^3.0.0", + "espree": "^9.0.0", + "semver": "^7.3.5" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ota-meshi" + } + }, "node_modules/jsonc-parser": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", @@ -4854,6 +4939,22 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha512-snN4O4TkigujZphWLN0E//nQmm7790RYaE53DdL7ZYwee2D8DDo9/EyYiKUfN3rneWUjhJnueija3G9I2i0h3g==", + "dev": true, + "dependencies": { + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" + } + }, + "node_modules/optimist/node_modules/minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha512-iotkTvxc+TwOm5Ieim8VnSNvCDjCK9S8G3scJ50ZthspSxa7jx50jkhYduuAtAjvfDUwSgOwf8+If99AlOEhyw==", + "dev": true + }, "node_modules/optionator": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", @@ -4910,6 +5011,18 @@ "node": ">=6" } }, + "node_modules/package-json-validator": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/package-json-validator/-/package-json-validator-0.6.4.tgz", + "integrity": "sha512-sp5bWr5eUoVgNV50vsJyil0XCluM+qMvtba8X4ug5Z/0YtYZsePka+tZgqiZnAyFyf5pwXaSDwYncFdSEzX7PA==", + "dev": true, + "dependencies": { + "optimist": "~0.6.0" + }, + "bin": { + "pjv": "bin/pjv" + } + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -5582,6 +5695,48 @@ "pnpm": ">= 9" } }, + "node_modules/sort-object-keys": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sort-object-keys/-/sort-object-keys-1.1.3.tgz", + "integrity": "sha512-855pvK+VkU7PaKYPc+Jjnmt4EzejQHyhhF33q31qG8x7maDzkeFhAAThdCYay11CISO+qAMwjOBP+fPZe0IPyg==", + "dev": true + }, + "node_modules/sort-package-json": { + "version": "1.57.0", + "resolved": "https://registry.npmjs.org/sort-package-json/-/sort-package-json-1.57.0.tgz", + "integrity": "sha512-FYsjYn2dHTRb41wqnv+uEqCUvBpK3jZcTp9rbz2qDTmel7Pmdtf+i2rLaaPMRZeSVM60V3Se31GyWFpmKs4Q5Q==", + "dev": true, + "dependencies": { + "detect-indent": "^6.0.0", + "detect-newline": "3.1.0", + "git-hooks-list": "1.0.3", + "globby": "10.0.0", + "is-plain-obj": "2.1.0", + "sort-object-keys": "^1.1.3" + }, + "bin": { + "sort-package-json": "cli.js" + } + }, + "node_modules/sort-package-json/node_modules/globby": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.0.tgz", + "integrity": "sha512-3LifW9M4joGZasyYPz2A1U74zbC/45fvpXUvO/9KbSa+VV0aGZarWkfdgKyR9sExNP0t0x0ss/UMJpNpcaTspw==", + "dev": true, + "dependencies": { + "@types/glob": "^7.1.1", + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.0.3", + "glob": "^7.1.3", + "ignore": "^5.1.1", + "merge2": "^1.2.3", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -6127,6 +6282,15 @@ "spdx-expression-parse": "^3.0.0" } }, + "node_modules/validate-npm-package-name": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-5.0.1.tgz", + "integrity": "sha512-OljLrQ9SQdOUqTaQxqL5dEfZWrXExyyWsozYlAWFawPVNuD83igl7uJD2RTkNMbniIYgt8l81eCJGIdQF7avLQ==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/vue": { "version": "3.4.27", "resolved": "https://registry.npmjs.org/vue/-/vue-3.4.27.tgz", @@ -6221,6 +6385,15 @@ "node": ">= 8" } }, + "node_modules/wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha512-1tMA907+V4QmxV7dbRvb4/8MaRALK6q9Abid3ndMYnbyo8piisCmeONVqVSXqQA3KaP4SLt5b7ud6E2sqP8TFw==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", diff --git a/package.json b/package.json index 31ad404..60061cf 100644 --- a/package.json +++ b/package.json @@ -2,26 +2,6 @@ "name": "vue-ts-types", "version": "1.6.2", "description": "Lightweight TypeScript-first Vue prop type definitions", - "main": "dist/index.js", - "types": "dist/index.d.ts", - "scripts": { - "test": "jest", - "test:watch": "jest --watch", - "type-test": "tstyche", - "format": "prettier . --write", - "lint": "npm run lint:eslint && npm run lint:markdownlint && npm run lint:prettier", - "lint:eslint": "eslint .", - "lint:markdownlint": "markdownlint \"**/*.md\"", - "lint:prettier": "prettier . --check", - "build": "tsc --project tsconfig.build.json" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/FloEdelmann/vue-ts-types.git" - }, - "files": [ - "dist" - ], "keywords": [ "vue", "vue2", @@ -36,12 +16,32 @@ "proptypes", "hacktoberfest" ], - "author": "Flo Edelmann", - "license": "MIT", + "homepage": "https://github.com/FloEdelmann/vue-ts-types", "bugs": { "url": "https://github.com/FloEdelmann/vue-ts-types/issues" }, - "homepage": "https://github.com/FloEdelmann/vue-ts-types", + "repository": { + "type": "git", + "url": "git+https://github.com/FloEdelmann/vue-ts-types.git" + }, + "license": "MIT", + "author": "Flo Edelmann", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "files": [ + "dist" + ], + "scripts": { + "build": "tsc --project tsconfig.build.json", + "format": "prettier . --write", + "lint": "npm run lint:eslint && npm run lint:markdownlint && npm run lint:prettier", + "lint:eslint": "eslint .", + "lint:markdownlint": "markdownlint \"**/*.md\"", + "lint:prettier": "prettier . --check", + "test": "jest", + "test:watch": "jest --watch", + "type-test": "tstyche" + }, "devDependencies": { "@eslint/js": "^9.3.0", "@jest/globals": "^29.7.0", @@ -49,6 +49,7 @@ "eslint-config-prettier": "^9.1.0", "eslint-plugin-jest": "^28.5.0", "eslint-plugin-jest-formatting": "^3.1.0", + "eslint-plugin-package-json": "^0.14.0", "eslint-plugin-unicorn": "^53.0.0", "jest": "^29.7.0", "jest-extended": "^4.0.2",