Socket
Socket
Sign inDemoInstall

@arnaud-barre/eslint-config

Package Overview
Dependencies
10
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arnaud-barre/eslint-config


Version published
Weekly downloads
601
increased by53.32%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

eslint-config npm

Install

yarn add --dev eslint @arnaud-barre/eslint-config
// .eslintrc.cjs
module.exports = {
  root: true,
  extends: ["@arnaud-barre"],
};
// package.json
"scripts": {
  "lint": "bun lint-ci --fix --cache",
  "lint-ci": "eslint ./ --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
}

TS config

{
  "include": ["**/*.ts", "**/*.tsx"],
  "compilerOptions": {
    "target": "ES2021",
    "useDefineForClassFields": true,
    "jsx": "react-jsx",
    "module": "ESNext",
    "lib": ["ES2021", "DOM", "DOM.Iterable"],

    /* Bundler mode */
    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "verbatimModuleSyntax": true,
    "noEmit": true,

    /* Linting */
    "skipLibCheck": true,
    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noFallthroughCasesInSwitch": true,
    "useUnknownInCatchVariables": true,
    "noPropertyAccessFromIndexSignature": true
  }
}

For Node projects

{
  "include": ["**/*.ts"],
  "compilerOptions": {
    "target": "ES2022",
    "module": "ESNext",
    "lib": ["ES2022"]

    /* ... */
  }
}

Adding local rules

Local rules are loaded from eslint-plugin/index.cjs. Here is an example for an hypothetical "no-while" rule (that could simply be achieved by using the no-restricted-syntax rule)

// eslint-plugin/index.cjs
exports.rules = {
  "no-while": {
    meta: {
      messages: { error: "Don't use while" },
      type: "problem",
      schema: [],
    },
    create: (context) => ({
      WhileStatement(node) {
        context.report({ node, messageId: "error" });
      },
    }),
  },
};
//  .eslintrc.cjs
module.exports = {
  root: true,
  extends: ["@arnaud-barre"],
  rules: {
    "@arnaud-barre/local/no-while": "warn",
  },
};

FAQs

Last updated on 03 Apr 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc