0.0.2 • Published 8 months ago

eslint-config-murmuration-frontend v0.0.2

Weekly downloads
-
License
-
Repository
-
Last release
8 months ago

eslint-config-murmuration-frontend

Author

  • Harry Stephens

Installation

Then, install eslint-config with npm

npm install --save-dev eslint-config-murmuration-frontend

Setup

From wherever you installed eslint-config-murmuration-frontend, run:

sh node_modules/eslint-config-murmuration-frontend/setup.sh

Ensure that your IDE has the ESLint plugin installed, turned on, using automatic settings in either VS Code or WebStorm.

Visual Studio Code

Verify that ESLint is running by navigating to the Preferences: Open Settings (UI) and make sure the following settings are as follows:

  • Editor: Default Formatter is set to ESLint
  • Editor: Format On Save box is ticked
  • Eslint: Enable box is ticked
  • Eslint > Format: Enable box is ticked

WebStorm

Open Preferences and navigate to Languages & Frameworks | JavaScript | Code Quality Tools | ESLint, then set ESLint to Automatic ESLint Configuration.

Make sure the Run eslint --fix on save box is ticked.

Running from the Command Line

eslint ./DIRECTORY_TO_LINT --ext .ts --config .eslintrc.js --fix

Verify Setup

Double check that ESLint is working as expected by creating a new TypeScript file and pasting the following function in it:

// You should get all sorts of errors here.
let myTestFunction = (myTestString) => {
  myTestString = [
    "ESLint should be very upset",
    "about every aspect of this function"
  ]
  
  return myTestString
}

// If you replace the above code with:
const myTestFunction = (myTestString: Array<string>): string => {
  myTestString = [
    'ESLint should be very upset',
    'about every aspect of this function',
  ];

  return myTestString[0];
};

myTestFunction(['This should make', 'ESLint happy']);
// All warnings and errors should disappear

Lint your little heart out.