Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Use ESlint warnings and Prettier config
Thomas Scholtes committed 2 years ago
commit 50dd25a6b892b76e64e50816e5dd13f730c15661
parent a7f267932d2d787f0becbd5b2acd5c7a860bb45b
4 files changed +27 -47
modified .eslintrc.cjs
@@ -8,6 +8,7 @@ module.exports = {
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:svelte/recommended",
+
    "prettier",
  ],
  parser: "@typescript-eslint/parser",
  parserOptions: {
@@ -38,10 +39,7 @@ module.exports = {
  },
  plugins: ["@typescript-eslint", "no-only-tests"],
  rules: {
-
    semi: "off",
-
    "no-only-tests/no-only-tests": "error",
-
    curly: ["error", "multi-line", "consistent"],
-
    "keyword-spacing": ["error"],
+
    "no-only-tests/no-only-tests": "warn",
    "no-implicit-globals": ["error"],
    "no-restricted-globals": [
      "error",
@@ -54,27 +52,9 @@ module.exports = {
      "origin",
      "status",
    ],
-
    "no-trailing-spaces": ["error"],
-
    "no-multi-spaces": ["error"],
-
    "no-multiple-empty-lines": ["error"],
-
    "space-before-blocks": ["error"],
-
    "object-curly-spacing": ["error", "always"],
-
    "array-bracket-spacing": ["error", "never"],
-
    "space-before-function-paren": [
-
      "error",
-
      {
-
        anonymous: "always",
-
        named: "never",
-
        asyncArrow: "always",
-
      },
-
    ],
-
    "eol-last": ["error"],
-
    "key-spacing": ["error"],
-
    "@typescript-eslint/no-floating-promises": "error",
-
    "@typescript-eslint/object-curly-spacing": ["error", "always"],
-
    "@typescript-eslint/type-annotation-spacing": ["error"],
+
    "@typescript-eslint/no-floating-promises": "warn",
    "@typescript-eslint/naming-convention": [
-
      "error",
+
      "warn",
      {
        selector: "enumMember",
        format: ["PascalCase"],
@@ -108,43 +88,29 @@ module.exports = {
    ],
    "@typescript-eslint/no-explicit-any": "off",
    "@typescript-eslint/no-namespace": ["error", { allowDeclarations: true }],
-
    "@typescript-eslint/semi": ["error"],
-
    "@typescript-eslint/member-delimiter-style": [
-
      "error",
-
      {
-
        multiline: {
-
          delimiter: "semi",
-
          requireLast: true,
-
        },
-
        singleline: {
-
          delimiter: "semi",
-
          requireLast: false,
-
        },
-
      },
-
    ],
    "@typescript-eslint/member-ordering": [
-
      "error",
+
      "warn",
      { default: ["field", "signature", "constructor", "method"] },
    ],

-
    "@typescript-eslint/no-invalid-void-type": ["error"],
+
    "@typescript-eslint/no-invalid-void-type": ["warn"],
    // Disallow Unused Variables.
    // https://eslint.org/docs/rules/no-unused-vars
-
    "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
+
    "@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
    // Require using arrow functions as callbacks.
    // https://eslint.org/docs/rules/prefer-arrow-callback
-
    "prefer-arrow-callback": "error",
+
    "prefer-arrow-callback": "warn",
    // Require using const for variables that are never modified after declared.
    // https://eslint.org/docs/rules/prefer-const
-
    "prefer-const": "error",
+
    "prefer-const": "warn",
    // Disallow modifying variables that are declared using const.
    // https://eslint.org/docs/rules/no-const-assign
    "no-const-assign": "error",
    // Require let or const instead of var.
    // https://eslint.org/docs/rules/no-var
-
    "no-var": "error",
+
    "no-var": "warn",
    // Require `===` and `!==` comparisons.
-
    eqeqeq: "error",
+
    eqeqeq: "warn",
    // Allow explict type annotations for additional clarity.
    "@typescript-eslint/no-inferrable-types": "off",
  },
modified package-lock.json
@@ -44,6 +44,7 @@
        "@typescript-eslint/eslint-plugin": "^5.61.0",
        "chalk": "^5.3.0",
        "eslint": "^8.44.0",
+
        "eslint-config-prettier": "^8.8.0",
        "eslint-plugin-no-only-tests": "^3.1.0",
        "eslint-plugin-svelte": "^2.32.2",
        "execa": "^7.1.1",
@@ -1938,6 +1939,18 @@
        "url": "https://opencollective.com/eslint"
      }
    },
+
    "node_modules/eslint-config-prettier": {
+
      "version": "8.8.0",
+
      "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.8.0.tgz",
+
      "integrity": "sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA==",
+
      "dev": true,
+
      "bin": {
+
        "eslint-config-prettier": "bin/cli.js"
+
      },
+
      "peerDependencies": {
+
        "eslint": ">=7.0.0"
+
      }
+
    },
    "node_modules/eslint-plugin-no-only-tests": {
      "version": "3.1.0",
      "resolved": "https://registry.npmjs.org/eslint-plugin-no-only-tests/-/eslint-plugin-no-only-tests-3.1.0.tgz",
modified package.json
@@ -35,6 +35,7 @@
    "@typescript-eslint/eslint-plugin": "^5.61.0",
    "chalk": "^5.3.0",
    "eslint": "^8.44.0",
+
    "eslint-config-prettier": "^8.8.0",
    "eslint-plugin-no-only-tests": "^3.1.0",
    "eslint-plugin-svelte": "^2.32.2",
    "execa": "^7.1.1",
modified scripts/check
@@ -2,6 +2,6 @@
set -e

npx tsc --noEmit
-
npx svelte-check --tsconfig tsconfig.json
-
npx eslint --cache --cache-location node_modules/.cache/eslint .
+
npx svelte-check --tsconfig tsconfig.json --fail-on-warnings
+
npx eslint --cache --cache-location node_modules/.cache/eslint --max-warnings 0 .
npx prettier "**/*.@(ts|js|svelte|json|css|html|yml)" --ignore-path .gitignore --check --cache