1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Why eslint checks index.hmtl file?

Discussão em 'Angular' iniciado por Raji, Outubro 17, 2024 às 23:02.

  1. Raji

    Raji Guest

    Why eslint checks index.hmtl file?


    I'm Trying to lint an analogjs project created with nx monorepo with this eslint config (i know what the problem in that config because if i delete path to the config from extends array of my root eslint config everything works fine).


    Getting an error

    ESLint: 9.12.0

    TypeError: Cannot read properties of undefined (reading 'at')
    Occurred while linting C:\Users\sergd\work\pohorony.by\pohorony.by\packages\analog-app\index.html:2
    Rule: "@typescript-eslint/ban-ts-comment"
    at Program (C:\Users\sergd\work\pohorony.by\pohorony.by\node_modules\@typescript-eslint\eslint-plugin\dist\rules\ban-ts-comment.js:118:50)
    at ruleErrorHandler (C:\Users\sergd\work\pohorony.by\pohorony.by\node_modules\eslint\lib\linter\linter.js:1084:48)


    index.html

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8" />
    <title>MyApp</title>
    <base href="/" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="icon" type="image/x-icon" href="/favicon.ico" />
    <link rel="stylesheet" href="/src/styles.css" />
    </head>
    <body>
    <analog-app-root></analog-app-root>
    <script type="module" src="/src/main.ts"></script>
    </body>
    </html>


    eslint.base.json

    {
    "env": { "browser": true, "es2021": true, "node": true },
    "extends": ["eslint:recommended", "plugin:mad:typescript-eslint/recommended", "./.eslintrc.angular.json", "prettier"],
    "ignorePatterns": ["*dist*"],
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
    "ecmaVersion": "latest",
    "project": true,
    "sourceType": "module"
    },
    "plugins": ["@typescript-eslint"],
    "overrides": [
    {
    "files": ["*.ts"],
    "rules": {
    "@typescript-eslint/array-type": ["error", { "default": "array" }],
    "@typescript-eslint/explicit-function-return-type": "error",
    "@typescript-eslint/lines-between-class-members": "off",
    "@typescript-eslint/no-explicit-any": "off",
    "@typescript-eslint/no-non-null-assertion": "off",
    "@typescript-eslint/no-unnecessary-type-assertion": "error",
    "@typescript-eslint/no-unused-vars": "off",
    "block-spacing": ["warn", "always"],
    "curly": ["warn", "all"],
    "eol-last": "error",
    "import/prefer-default-export": "off",
    "import/no-unresolved": "error",
    "max-len": [
    "error",
    {
    "code": 120,
    "ignoreComments": true,
    "tabWidth": 2,
    "ignoreStrings": true
    }
    ],
    "max-lines-per-function": ["error", 80],
    "max-classes-per-file": "off",
    "no-console": "off",
    "no-debugger": "off",
    "no-multiple-empty-lines": ["error", { "max": 2, "maxBOF": 0, "maxEOF": 1 }],
    "no-param-reassign": ["error", { "props": false }],
    "no-plusplus": "off",
    "no-return-assign": 1,
    "no-restricted-syntax": ["off", "ForInStatement"],
    "no-underscore-dangle": "off",
    "no-template-curly-in-string": "warn",
    "no-unused-vars": "off",
    "object-curly-spacing": ["warn", "always"],
    "spaced-comment": ["error", "always", { "markers": ["!", "?", "//", "todo", "*"] }],

    "class-methods-use-this": "off",
    "@typescript-eslint/no-inferrable-types": "off",
    "@typescript-eslint/explicit-member-accessibility": [
    "error",
    {
    "accessibility": "explicit",
    "overrides": {
    "accessors": "explicit",
    "constructors": "off",
    "methods": "explicit",
    "properties": "explicit",
    "parameterProperties": "explicit"
    }
    }
    ]
    }
    },
    {
    "files": ["*.spec.ts", "*.test.ts"],
    "rules": {
    "max-lines-per-function": "off"
    }
    }
    ]
    }



    I have tried to remove all the rules and plugin:mad:typescript-eslint/recommended and everything works fine.

    Continue reading...

Compartilhe esta Página