Skip to content

the-arena-project/eslint-plugin-julius

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@thearenaproject/eslint-plugin

Eslint rules for TheArenaProject

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install @thearenaproject/eslint-plugin:

npm install @thearenaproject/eslint-plugin --save-dev

Usage

Add the eslint plugin to the plugins section of your .eslintrc.js configuration file.

{
  plugins: ["@thearenaproject/eslint-plugin"];
}

Then you can configure the rules globally or per file.

globally:

{
  rules: {
    '@thearenaproject/no-for-loops': 'error',
    '@thearenaproject/no-methods-or-properties': 'error',
  }
}

per file:

{
  overrides: [
    {
      files: ['round-00/*.ts'],
      excludedFiles: '*.test.js',
      rules: {
        '@thearenaproject/no-methods-or-properties': ['error', {
          allowed: [
            // allow ".log" only on the "console" object
            ['log', 'console'],
          ],
        }],
      },
    },
    {
      files: ['round-01/*.ts'],
      excludedFiles: '*.test.js',
      rules: {
        '@thearenaproject/no-methods-or-properties': ['error', {
          allowed: [
            ['stdout', 'process'], // allow "process.stdout" pair
            ['write', 'stdout'], // allow "stdout.write" pair
            'log', // allow any ".log" in a file
          ],
        }],
      },
    },
    ...
  ],
}

Supported Rules

  • Fill in provided rules here

Creating new rules

Basics

Each rule is composed of 3 parts and only the 1st is mandatory:

  1. The rule file under ./lib/rules folder. (mandatory)
  2. The test file under ./tests/lib/rules folder.
  3. The doc file under ./docs/rules folder.

Adding new rules with the generator (no, false, faux, ❌)

Do not use this https://github.com/eslint/generator-eslint because it doesn't generate a plugin or rule with our namespace (@thearenaproject). Even if this plugin and its rules were generated with the generator, multiple manual changes were required, so don't go this way and just read the next section ⬇️.

Adding new rules the right way (yes, true, vrai, ✅)

For now just copy an existing rule/test/doc file, rename it and update its content.
Yep hardcore, old style, now fuck-off.

Some reading material is here :

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published