Skip to content

Commit

Permalink
Upgrades (#4)
Browse files Browse the repository at this point in the history
* tweaks

* fixes

* bump
  • Loading branch information
Zoe authored Sep 25, 2024
1 parent e8a8508 commit 9d75f7a
Show file tree
Hide file tree
Showing 11 changed files with 3,191 additions and 2,591 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

122 changes: 0 additions & 122 deletions .eslintrc.json

This file was deleted.

1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"singleQuote": false,
"trailingComma": "all",
"jsxSingleQuote": false,
"printWidth": 100,
"arrowParens": "avoid"
}
167 changes: 167 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
import importPlugin from "eslint-plugin-import";
import jsonc from "eslint-plugin-jsonc";
import noUnsanitized from "eslint-plugin-no-unsanitized";
import sonarjs from "eslint-plugin-sonarjs";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import sortKeysFix from "eslint-plugin-sort-keys-fix";
import unicorn from "eslint-plugin-unicorn";
import prettier from "eslint-plugin-prettier";
import { fixupPluginRules } from "@eslint/compat";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
sonarjs.configs.recommended,
{
plugins: {
import: fixupPluginRules(importPlugin),
jsonc,
"no-unsanitized": noUnsanitized,
"simple-import-sort": simpleImportSort,
"sort-keys-fix": sortKeysFix,
unicorn,
prettier,
},
languageOptions: {
globals: { ...globals.node },
},
},
...compat
.extends(
"plugin:@typescript-eslint/recommended",
"plugin:jsonc/recommended-with-jsonc",
"plugin:unicorn/recommended",
"plugin:prettier/recommended",
"plugin:@cspell/recommended",
)
.map(config => ({ ...config, files: ["src/**/*.ts"] })),
{
files: ["src/**/*.ts"],
languageOptions: {
parser: tsParser,
ecmaVersion: 5,
sourceType: "script",
parserOptions: {
project: ["tsconfig.json"],
},
},
rules: {
"prettier/prettier": "error",
"unicorn/switch-case-braces": "off",
"unicorn/prefer-module": "off",
"@typescript-eslint/no-magic-numbers": "warn",
"unicorn/no-object-as-default-parameter": "off",
"unicorn/no-null": "off",
"unicorn/no-empty-file": "off",
"sonarjs/prefer-single-boolean-return": "off",
"unicorn/no-array-callback-reference": "off",
"sonarjs/prefer-nullish-coalescing": "off",
"sonarjs/hashing": "off",
"unicorn/no-process-exit": "off",
"sonarjs/function-return-type": "off",
"unicorn/no-await-expression-member": "off",
"sonarjs/no-invalid-await": "off",
"sonarjs/no-nested-functions": "off",
"unicorn/no-useless-undefined": "off",
"@typescript-eslint/unbound-method": "error",
"sonarjs/sonar-no-fallthrough": "off",
"import/no-extraneous-dependencies": [
"error",
{
"packageDir": "./"
}
],
"sonarjs/prefer-immediate-return": "off",
"unicorn/prevent-abbreviations": [
"error",
{
"replacements": {
"docs": false,
"e": false,
"dir": false,
"i": false,
"params": false,
"fn": false,
"props": false,
"ref": false,
"temp": false
}
}
],
"no-case-declarations": "off",
"no-async-promise-executor": "off",
"unicorn/prefer-node-protocol": "off",
"unicorn/no-array-for-each": "off",
"sonarjs/no-clear-text-protocols": "off",
"unicorn/import-style": "off",
"sonarjs/fixme-tag": "off",
"sort-keys-fix/sort-keys-fix": "warn",
"unicorn/prefer-event-target": "off",
"simple-import-sort/imports": "warn",
"sonarjs/no-misused-promises": "off",
"sonarjs/no-commented-code": "off",
"@typescript-eslint/no-empty-object-type": "off",
"sonarjs/todo-tag": "off",
"simple-import-sort/exports": "warn",
"no-console": [
"error"
],
"@typescript-eslint/no-unnecessary-type-constraint": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"varsIgnorePattern": "_|logger"
}
],
"@typescript-eslint/no-explicit-any": "error"
}
},
// module definitions
{
files: ["src/**/*.module.ts"],
languageOptions: {
parser: tsParser,
ecmaVersion: 5,
sourceType: "script",
parserOptions: {
project: ["tsconfig.json"],
},
},
rules: {
"@typescript-eslint/no-magic-numbers": "off",
},
},
{
files: ["src/**/*.spec.ts"],
languageOptions: {
globals: { ...globals.jest },
parser: tsParser,
ecmaVersion: 5,
sourceType: "script",
parserOptions: {
project: ["tsconfig.json"],
},
},
rules: {
"@cspell/spellchecker": "off",
"@typescript-eslint/no-magic-numbers": "off",
"@typescript-eslint/unbound-method": "off",
"sonarjs/no-duplicate-string": "off",
"sonarjs/no-unused-collection": "warn",
"sonarjs/prefer-promise-shorthand": "off",
"unicorn/consistent-function-scoping": "off",
},
},
];
67 changes: 35 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"type": "module",
"name": "@digital-alchemy/mqtt-extension",
"repository": "https://github.com/Digital-Alchemy-TS/mqtt",
"homepage": "https://docs.digital-alchemy.app/MQTT",
"version": "24.7.1",
"version": "24.9.1",
"scripts": {
"build": "rm -rf dist/; tsc",
"test": "./scripts/test.sh",
Expand All @@ -25,45 +26,47 @@
},
"license": "MIT",
"dependencies": {
"mqtt": "^5.5.2",
"mqtt-packet": "^9.0.0",
"prom-client": "^15.1.1"
"mqtt": "^5.10.1",
"mqtt-packet": "^9.0.0"
},
"peerDependencies": {
"@digital-alchemy/core": "*"
},
"devDependencies": {
"@cspell/eslint-plugin": "^8.7.0",
"@digital-alchemy/core": "^24.8.3",
"@types/figlet": "^1.5.8",
"@types/jest": "^29.5.12",
"@types/js-yaml": "^4.0.9",
"@types/minimist": "^1.2.5",
"@types/mute-stream": "^0.0.4",
"@types/node": "^20.12.7",
"@types/uuid": "^9.0.8",
"@types/ws": "^8.5.10",
"@typescript-eslint/eslint-plugin": "7.6.0",
"@typescript-eslint/parser": "7.6.0",
"eslint": "8.57.0",
"@cspell/eslint-plugin": "^8.14.4",
"@digital-alchemy/core": "^24.9.3",
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.11.1",
"@types/jest": "^29.5.13",
"@types/node": "^22.7.0",
"@types/node-cron": "^3.0.11",
"@types/ws": "^8.5.12",
"@typescript-eslint/eslint-plugin": "8.7.0",
"@typescript-eslint/parser": "8.7.0",
"dayjs": "^1.11.13",
"dotenv": "^16.4.5",
"eslint": "9.11.1",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsonc": "^2.15.1",
"eslint-plugin-no-unsanitized": "^4.0.2",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-security": "^3.0.0",
"eslint-plugin-simple-import-sort": "^12.1.0",
"eslint-plugin-sonarjs": "^0.25.1",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-jsonc": "^2.16.0",
"eslint-plugin-no-unsanitized": "^4.1.1",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-security": "^3.0.1",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-sonarjs": "^2.0.2",
"eslint-plugin-sort-keys-fix": "^1.1.2",
"eslint-plugin-unicorn": "^52.0.0",
"eslint-plugin-unicorn": "^55.0.0",
"globals": "^15.9.0",
"jest": "^29.7.0",
"jest-environment-node": "^29.7.0",
"npm-check-updates": "^16.14.18",
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"tsx": "^4.7.2",
"type-fest": "^4.15.0",
"typescript": "^5.4.5"
"node-cron": "^3.0.3",
"prettier": "^3.3.3",
"ts-jest": "^29.2.5",
"tsx": "^4.19.1",
"type-fest": "^4.26.1",
"typescript": "^5.6.2",
"ws": "^8.18.0"
},
"packageManager": "yarn@4.4.0"
"packageManager": "yarn@4.5.0"
}
Loading

0 comments on commit 9d75f7a

Please sign in to comment.