📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

eslint-config-exzeo

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-config-exzeo

Eslint v9 requires a new config file known as a flat config. The eslint documentation has a [detailed migration guide](https://eslint.org/docs/latest/use/configure/migration-guide) available for any in-depth issues with migrating, as well as full breaking

2.0.0
latest
Source
npm
Version published
Weekly downloads
425
13.03%
Maintainers
0
Weekly downloads
 
Created
Source

eslint-config-exzeo with eslint v9

Eslint v9 requires a new config file known as a flat config. The eslint documentation has a detailed migration guide available for any in-depth issues with migrating, as well as full breaking changes list.

Migrating existing configs

For services with simple configs and limited ignores, you can delete all .eslintrc.json and .eslintignore files,and replace it with the following and have a working config with all default ignores:

import exzeoBaseConfig from 'eslint-config-exzeo/base';
import exzeoMochaConfig from 'eslint-config-exzeo/mocha';
export default [
  exzeoBaseConfig,
  exzeoMochaConfig
];

New configs, customization and updating migrated configs

You can get started quickly with a new config by importing the "base" config into an eslint.config.js file. Importing the base config would look like this:

import exzeoBase from 'eslint-config-exzeo/base';
export default [
  exzeoBase
];

Ignoring files

.eslintignore files are deprecated in version 9. Add globally ignored files to the config using a glob. By default, the config ignores node_modules and **/documentation.

import exzeoBase from 'eslint-config-exzeo/base';
export default [
  exzeoBase,
  { ignores: ['**/dist'] }
];

Linting tests

This package exports mocha specific configs for linting test files. You can specify which files get linted with which config by using a files array and a glob. By default, the mocha config will lint all tests with a file extension of *.test.js.

import exzeoBaseConfig from 'eslint-config-exzeo/base';
import exzeoMochaConfig from 'eslint-config-exzeo/mocha';


export default [
  exzeoBaseConfig,
  {
    ...exzeoMochaConfig,
    files: [...exzeoMochaConfig.files, 'test/**/*']
  },
];

Extending the config

In most cases, you want to extend the config while leaving it mostly intact, by either adding additional ignores, disabling certain rules per config, or adding additional files. Use the spread operator to extend the config.

import exzeoBaseConfig from 'eslint-config-exzeo/base';
import exzeoMochaConfig from 'eslint-config-exzeo/mocha';

export default [
  {
    ...exzeoBaseConfig,
    rules: {
      ...exzeoBaseConfig.rules, // keep all base rules from config
      'thisrulesucks': 'off' // turn off one rule only for files linted by base config
    },
    ignores: [...exzeoBaseConfig.ignores, 'scripts/**/*'] // ignore scripts dir in addition to the default ignores
  },
  {
    ...exzeoMochaConfig,
    files: [...exzeoMochaConfig.files, 'stress-test/**/*'] // add an additional directory to apply mocha test linting to
  }
];

Overriding rules

You can customize rules by adding them to a rules object. Adding rules in a seperate object overrides the rules for all configs above them.

import exzeoBaseConfig from 'eslint-config-exzeo/base';
import exzeoMochaConfig from 'eslint-config-exzeo/mocha';

export default [
  exzeoBaseConfig,
  exzeoMochaConfig,
  {
    rules: {
      'thisrulesucks': 'off'
    }
  }
];

Typescript Linting

There are preset typescript and typescript mocha configs exported from this package. You will need to install the typescript-eslint package to use the configs. More information about how to set this up is available in the docs for this package. The 'extends' keyword is valid for this config, so you can easily extend using that instead of the spread operator. An example config for ts would look something like this:

import tseslint from 'typescript-eslint'

import exzeoTsConfig from 'eslint-config-exzeo/ts';
import exzeoTsMochaConfig from 'eslint-config-exzeo/ts-mocha';

export default tseslint.config(
    ...exzeoTsConfig,
    {
        files: ['test/**/*'], // lint everything in test folder in addition to default
        extends: [exzeoTsMochaConfig],
        rules: {
            '@typescript-eslint/no-unused-vars': 'off' // disable one rule for tests only
        },
    },
    { ignores: ['dist/**/*',  '**/node_modules'] } // global ignores
)

Helpful commands for debugging configs

Debug logs for a given file:

npx eslint --debug file.js

Inspect config, includes a gui for examining how your config is built and what different rules/files/and ignores are applied to what:

npx eslint --inspect-config

Print out the config that is being used for a given file:

npx eslint --print-config file.js

Further debugging information available in eslint's documentation

FAQs

Package last updated on 24 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts