Skip to content

archisquad/eslint-config-archisquad

Repository files navigation

archisquad ESLint Config

Our shareable config & rules for ESLint v9

npm version npm downloads CI: Test

How to use it?

1.Add package & necessary dependencies (such as ESlint & Prettier) to your repository, for, e.g. with pnpm or your package manager of choice:

pnpm i -D eslint prettier eslint-config-archisquad

2.Create your local ESLint config file with archisquad configFactory:

import { configFactory } from "eslint-config-archisquad"

export default await configFactory({
  // your config goes here
})

Configuration

Our ESLint configuration is quite configurable, let's deep dive into the options.

import { configFactory } from "eslint-config-archisquad"

export default await configFactory({
  // Basically it's all abut enabling some plugins. All features are disabled by default.
  features: {
    // Enables the eslint-compat-plugin
    compat: true,
    // Enables the eslint-promise-plugin
    promise: true,
    // Enables the eslint-secrets-plugin
    secrets: true
  },
  // Support for different frameworks.
  frameworks: {
    // You can also set to `true` if all of your files are for Node.js
    node: {
      // Pass the glob pattern for matching for enable Playwright config
      files: ["server/**/*.ts"],
    },
    playwright: {
      // Pass the glob pattern for matching for enable Playwright config
      files: ["tests/**/*.e2e.ts"],
    },
    vitest: {
      // Pass the glob pattern for matching for enable Playwright config
      files: ["tests/**/*.test.ts"],
      // Set to true if your test files are written in TypeScript
      typescript: true,
    }
  },
  // Configuration for different languages, each of them can be simply turned on, by setting
  // true. If you want to customize the files, set an object value.
  language: {
    json: {
      files: ["**/*.json"],
    },
    markdown: {
      files: ["**/*.md", "**/*.mdx"],
    },
    typescript: {
      files: ["**/*.ts", "**/*.tsx", "**/*.cts", "**/*.mts"],
    },
    yaml: {
      files: ["**/*.yaml", "**/*.yml"],
    },
  },
  // Options for plugins built-in into this ESLint config
  options: {
    // Setup for Perfectionist plugin
    perfectionist: {
      ignoreCase: true,
      order: "asc",
      sortType: "alphabetical"
      // There is more advanced options available, to dig into look at the types.ts file
    }
  }
})

Used rulesets & plugins

Development

First make a copy of this repository and install all dependencies using pnpm:

git clone git@github.com:archisquad/eslint-config-archisquad.git
cd eslint-config-archisquad
pnpm i

Then, create a branch, make your changes in code, commit it following gitmoji & conventional commits styles.

After that, push it and then create a Pull Request with the target to main branch.

License

MIT