Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

agustinusnathaniel/eslint-config-sznm

Repository files navigation

Warning

This library is deprecated, as some of the dependencies being used in this library has also been deprecated. It's recommended to switch to alternatives:

Note

This config library only works for:

  • Next.js v14 or earlier version
  • eslint v8 or earlier
  • projects with @typescript-eslint v7 or earlier


npm npm

Verified on Openbase Rate this package

⚠️ Pre-Requisites

eslint-config-sznm v2.x+ only supports prettier v3 as prettier v3 is a breaking change and it applies to its related eslint plugins. If your project is using prettier v2, please install eslint-config-sznm v1.1.2 🙏

🔧 Installation

If your project uses prettier v3

npm i --save-dev eslint eslint-config-sznm

# or (if using yarn)
yarn add -D eslint eslint-config-sznm

# or (if using pnpm)
pnpm i -D eslint eslint-config-sznm

If your project uses prettier v2

npm i --save-dev eslint eslint-config-sznm@^1.1.2

# or (if using yarn)
yarn add -D eslint eslint-config-sznm@^1.1.2

# or (if using pnpm)
pnpm i -D eslint eslint-config-sznm@^1.1.2

💻 Usage

add the extends to your project's eslintrc config (.eslintrc.js or other extensions whichever you use in your project)

⚡ Next.js Projects

make sure eslint-config-next is installed (as devDependencies)

/** @type {import('eslint').Linter.Config} */
module.exports = {
  extends: ['sznm/react', 'plugin:@next/next/recommended'],
};

optional:

/** @type {import('eslint').Linter.Config} */
module.exports = {
  extends: [
    'sznm/react',
    'plugin:react/jsx-runtime', // to switch off jsx (import React) warning
    'plugin:@next/next/recommended',
  ],
};

⚛️ React Projects

/** @type {import('eslint').Linter.Config} */
module.exports = {
  extends: ['sznm/react'],
};

🟨 Non React Projects

⚠️ [WIP] still tinkering around here, I made this config with support for Next.js and React + TypeScript as first priority in mind.

/** @type {import('eslint').Linter.Config} */
module.exports = {
  extends: [
    'sznm', // or 'sznm/bare'
  ],
};

🐣 Rules

eslint-config-sznm extends from and uses these configurations & plugins:

  • eslint-config-airbnb: airbnb's javascript styleguide
  • eslint-config-prettier: to turns off all rules that are unnecessary or might conflict with Prettier.
  • eslint-plugin-prettier: runs Prettier as an ESLint rule and reports differences as individual ESLint issues.
  • eslint-plugin-sonarjs: SonarJS rules for ESLint to detect bugs and suspicious patterns in your code.

📣 Suggestions

feel free to give feedbacks or suggestions or start a discussion in Github discussions of the repo.