Instructions for activating "error prevention only" in TSLint: How can you turn off style checks and other features?

After creating and running my first Vue.js + TypeScript project, I decided to reformat the TypeScript code to my liking. However, when I ran the npm run serve command, I received the following warning:

WARNING in .../src/app/app.ts
7:1 misplaced opening brace
     5 | })
     6 | export default class App extends Vue
  >  7 | {
       | ^
     8 |
     9 | }
    10 |
No type errors found
Version: typescript 3.5.3, tslint 5.18.0
Time: 1148ms

Is there a way to activate only the error checks in TSLint without turning on any of the style check rules?

Even after following the advice on TSLint: how to disable all style/readability rules and removing all the rules in my tslint.json file, I still encountered the same warning.

My current tslint.json configuration:

{
  "defaultSeverity": "warning",
  "extends": [
    "tslint:recommended"
  ],
  "linterOptions": {
    "exclude": [
      "node_modules/**"
    ]
  }/*,
  "rules": {
    "indent": [true, "spaces", 4],
    "quotemark": [true, "single"]
  }*/
}

Answer №1

One of the key configuration options to note is:

"extends": [
    "tslint:recommended"
  ]

By including this, TSLint is instructed to utilize the preset configuration called recommended.

tslint:recommended consists of a stable and somewhat opinionated set of rules that are recommended for general TypeScript programming.

If you remove the extends section, you will start with a clean slate. To explore the default preset settings, you can refer to this link.

Moreover, you have the option to selectively disable certain rules, like so:

"rules": { "curly": false }

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

TS1316 Error: You can only have global module exports at the top level of the file

Encountering difficulties while trying to compile an older typescript project that I am revisiting. The build process is failing due to an issue with q. I suspect it may be related to the tsc version, but no matter which version I try, errors persist. Som ...

Angular-meteor tutorials have a method known as '/parties/insert' that is already clearly defined and explained

I am currently diving into meteor + angular and enjoying learning through ! As I was working on the 3-way data binding section, I created a folder named collections within the socially folder. In this folder, I made a file called parties.ts where I added ...

Refresh the page to change the section using vue.js

I am currently working on a website using Laravel and Vue.js. I require two separate sections for the site: Site: https://www.example.com Admin: https://www.example.com/admin Within the resource/js/app.js file, I have included the main components as fo ...

Redirect all erroneous URLs to a custom 404 page using NuxtJS

Hello there, I am facing a challenge that I can't seem to figure out on my own. I want to redirect all incorrect URLs (such as "example mywebsite.com/asdasdasdasd") to my website's error page at mywebsite.com/404. Can you please guide me on how ...

Exploring Nested Routes and Queries in Vue JS

As a beginner in Vue, I have been exploring a demo project and struggling with understanding how routes with query parameters function. The documentation suggests using router.push({ path: 'register', query: { plan: 'private' }}) to gen ...

Ways to include a link/href in HTML using a global constants file

I have a constants file with a links node that I need to integrate into my HTML or TypeScript file. Constants File export const GlobalConstants = { links: { classicAO: '../MicroUIs/' } } I created a public method called backToClassicAO ...

What is the best way to choose an ID that changes based on the index position?

Let me clarify my point first. Within a dropdown menu, there are 5 buttons - 2 with fixed IDs and 3 that can be altered through a separate micro service (such as when changing break types). The IDs for these 3 buttons are dynamically generated based on th ...

Sorting custom strings in Javascript with special characters like dash (-) and underscore (_)

I am attempting to create a custom sorting method with the following order: special character ( - first, _ last) digit alphabets For instance, when sorting the array below var words = ['MBC-PEP-1', 'MBC-PEP01', 'MBC-PEP91&apo ...

Making API calls using JavaScript

I'm struggling with understanding how to approach this problem in javascript. Here is the question along with the details. I would appreciate any assistance. QUERY We have a server backend that provides two endpoints: /GetLocalPressReleases and /Get ...

Guide to showing an uploaded image in a child component using Vue.js

Using the v-file-input component from Vuetify, I am able to upload images with the following code: <v-file-input label="Image" filled accept="image/png, image/jpeg, image/bmp" prepend-icon="mdi-camera" v-mod ...

Look for identical values within a nested array

My data consists of a nested array where each element has a property called name, which can only be either A or B. I need to compare all elements and determine if they are all either A or B. Here is an example of the input: [ { "arr": { "teach ...

Disabling ion-select in Ionic 2 with Typescript

To disable an ion-select element in Angular, you can use the disabled attribute like this: <ion-item> <ion-label stacked>Property Type</ion-label> <ion-select [(ngModel)]="propType" (ionChange)="ionChanger()" di ...

Is it possible to remove tsconfig.spec.json from an Angular project?

I recently started learning Angular and was introduced to the files tsconfig.app.json and tsconfig.spec.json when setting up an Angular app using Angular-CLI. I found a helpful point about these files on this website. Both tsconfig.*.json files serve as ...

How can Vue Router be integrated with Vue.JS SSR?

Despite reading up on SSR documentation, I am struggling to make it work (I feel lost). I created the project with Vue CLI using 'vue new frontend'. I opted for typescript and configured all settings in package.json. Additionally, I am utilizing ...

Issue with accessing custom method in subclass in Typescript

Recently delving into TypeScript, I decided to subclass Error and add a new method called getCode() in my MyError class. export class MyError extends Error { public code: number; constructor(code: number, message?: string) { super(mes ...

Tips for stopping Vue.js automatic merging of CSS classes

Recently, I embarked on my journey with Vue.js and have been thoroughly enjoying the experience. However, I've stumbled upon a challenge that has me stumped. Despite searching high and low and studying the documentation, I haven't found a solutio ...

What are the necessary requirements for executing the command "npm run build"?

What are the requirements for executing npm run build? I am currently working on a Vue project. My goal is to deploy it onto a new server. Will running npm install be sufficient for this purpose? ...

The specified field type of Int! was not included in the input

I encountered a GraphQL error that states: "Field JobInput.salarys of required type Int! was not provided." While working on my mutation, I have declared three variables and I'm unsure if the syntax "salarys: number;" is correct. Can someone please c ...

What is the reason for a high-order generic function to eliminate falsy types from the argument list of the returned function?

Consider this example of a unique Decorator Factory Builder - a builder that constructs Decorator Factories to define metadata for forms: interface FormFieldOptions { name?: string; label?: string; format?: string; } type FormProperties = Record< ...

What could be causing `RouterView` to not display any components?

After manually inserting all components/screens in the HTML and ensuring that the URL changes without errors, I am encountering an issue where no content is displayed in <RouterView>. Any insights would be appreciated. main.ts import { createApp, Vu ...