Skip to content

Commit

Permalink
Install eslint-plugin-package-json (#569)
Browse files Browse the repository at this point in the history
  • Loading branch information
FloEdelmann committed Jun 3, 2024
1 parent fd70737 commit 4cce1f9
Show file tree
Hide file tree
Showing 3 changed files with 217 additions and 24 deletions.
21 changes: 20 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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: {
Expand Down
173 changes: 173 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 24 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -36,19 +16,40 @@
"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",
"eslint": "^8.57.0",
"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",
Expand Down

0 comments on commit 4cce1f9

Please sign in to comment.