From 4cf87b200296ce8a004c14b415bb9b414f43f382 Mon Sep 17 00:00:00 2001 From: Matt Lyons Date: Wed, 6 Dec 2023 12:49:35 -0600 Subject: [PATCH] Add ESLint rule for flagging use of "null" --- .eslintrc.js | 3 ++- package-lock.json | 37 +++++++++++++++++++++++++++++++++++-- package.json | 1 + 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index eed51f2..1bbbfae 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -68,6 +68,7 @@ module.exports = { ], // Should use our logger anytime you want logs that persist. Otherwise use console only in testing 'no-console': 'warn', + 'no-null/no-null': 2, 'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], 'prettier/prettier': ['warn', { tabWidth: 2, trailingComma: 'all' }], 'react/jsx-indent-props': ['warn', 2], @@ -109,7 +110,7 @@ module.exports = { tsconfigRootDir: __dirname, createDefaultProgram: true, }, - plugins: ['@typescript-eslint'], + plugins: ['@typescript-eslint', 'no-null'], settings: { 'import/resolver': { typescript: { diff --git a/package-lock.json b/package-lock.json index fe35edb..a6383ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,6 +28,7 @@ "eslint-plugin-import": "^2.28.1", "eslint-plugin-jest": "^27.2.3", "eslint-plugin-jsx-a11y": "^6.7.1", + "eslint-plugin-no-null": "^1.0.2", "eslint-plugin-promise": "^6.1.1", "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", @@ -59,7 +60,9 @@ "../paranext-core/lib/papi-components": { "version": "0.0.1", "dev": true, - "dependencies": { + "hasInstallScript": true, + "license": "MIT", + "devDependencies": { "@mui/icons-material": "^5.13.7", "@senojs/rollup-plugin-style-inject": "^0.2.3", "@types/react": "^18.2.15", @@ -72,6 +75,7 @@ "eslint-config-prettier": "^8.8.0", "eslint-plugin-prettier": "^4.2.1", "prettier": "^2.8.8", + "prettier-plugin-jsdoc": "^0.4.2", "stylelint": "^15.10.2", "stylelint-config-recommended": "^13.0.0", "stylelint-config-sass-guidelines": "^10.0.0", @@ -79,12 +83,21 @@ "tslib": "^2.6.0", "typescript": "^5.1.6", "vite": "^4.4.6" + }, + "peerDependencies": { + "@emotion/react": ">=11.11.1", + "@emotion/styled": ">=11.11.0", + "@mui/material": ">=5.14.1", + "react": ">=18.2.0", + "react-data-grid": ">=7.0.0-beta.34", + "react-dom": ">=18.2.0" } }, "../paranext-core/lib/papi-dts": { "version": "0.0.1", "dev": true, - "dependencies": { + "license": "MIT", + "devDependencies": { "escape-string-regexp": "^5.0.0", "rimraf": "^5.0.1", "typescript": "^5.1.6" @@ -5302,6 +5315,18 @@ "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8" } }, + "node_modules/eslint-plugin-no-null": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-no-null/-/eslint-plugin-no-null-1.0.2.tgz", + "integrity": "sha512-uRDiz88zCO/2rzGfgG15DBjNsgwWtWiSo4Ezy7zzajUgpnFIqd1TjepKeRmJZHEfBGu58o2a8S0D7vglvvhkVA==", + "dev": true, + "engines": { + "node": ">=5.0.0" + }, + "peerDependencies": { + "eslint": ">=3.0.0" + } + }, "node_modules/eslint-plugin-prettier": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz", @@ -17108,6 +17133,13 @@ "semver": "^6.3.0" } }, + "eslint-plugin-no-null": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-no-null/-/eslint-plugin-no-null-1.0.2.tgz", + "integrity": "sha512-uRDiz88zCO/2rzGfgG15DBjNsgwWtWiSo4Ezy7zzajUgpnFIqd1TjepKeRmJZHEfBGu58o2a8S0D7vglvvhkVA==", + "dev": true, + "requires": {} + }, "eslint-plugin-prettier": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz", @@ -20580,6 +20612,7 @@ "eslint-config-prettier": "^8.8.0", "eslint-plugin-prettier": "^4.2.1", "prettier": "^2.8.8", + "prettier-plugin-jsdoc": "^0.4.2", "stylelint": "^15.10.2", "stylelint-config-recommended": "^13.0.0", "stylelint-config-sass-guidelines": "^10.0.0", diff --git a/package.json b/package.json index f7281b1..bf009ba 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "eslint-plugin-import": "^2.28.1", "eslint-plugin-jest": "^27.2.3", "eslint-plugin-jsx-a11y": "^6.7.1", + "eslint-plugin-no-null": "^1.0.2", "eslint-plugin-promise": "^6.1.1", "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0",