Home > Enterprise >  eslint is not getting disabled for specific file
eslint is not getting disabled for specific file

Time:09-22

I'm trying to create Notes.ts file for making notes of typescript. I need syntax highlighting but no eslint. How can i stop eslint to stop working for my notes file.

MyDir Structure

root/.eslintignore
root/NestJS.ts
root/package.json

NestJS.ts Contents

/* eslint-disable */

import { Controller, Get } from '@nestjs/common';

@Controller('/app')
export class AppController {
  @Get('/asdf')
  getRootRoute() {
    return 'hi there!';
  }

  @Get('/bye')
  getByeThere() {
    return 'bye there!';
  }
}

.eslintignore contents

**/*.js
**/*.ts
NestJs.ts

package.json contents

{
  "name": "notes",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "eslintConfig": {
    "env": {
      "browser": true,
      "node": true
    }
  },
  "eslintIgnore": [
    "NestJS.ts",
    "world.js"
  ]
}

even after adding /* eslint-disable */, eslint is showing me errors !!!

CodePudding user response:

You can create a file .eslintignore in the root catalog. The format of this file matches the format of .gitignore and you can add there not only files but directories too.

CodePudding user response:

Place the file in the .eslintignore or package.json's "eslintIgnore"

EDIT: if not working please show how you specified the path to the file

  • Related