akd-io / create-next-stack

Create Next Stack is a website and CLI tool used to easily set up the boilerplate of new Next.js apps.
https://www.create-next-stack.com
MIT License
561 stars 27 forks source link

Support for ESLint (Properly) #263

Open akd-io opened 10 months ago

akd-io commented 10 months ago

To do:

See the typescript-eslint configuration docs, mainly this quote:

We recommend that most projects should extend from one of:

  • recommended: Recommended rules for code correctness that you can drop in without additional configuration.
  • recommended-type-checked: Contains recommended + additional recommended rules that require type information.
  • strict: Contains recommended + additional strict rules that can also catch bugs but are more opinionated than recommended rules.
  • strict-type-checked: Contains strict + additional strict rules require type information.

Additionally, we provide a stylistic config that enforces concise and consistent code. We recommend that most projects should extend from either:

  • stylistic: Stylistic rules you can drop in without additional configuration.
  • stylistic-type-checked: Contains stylistic + additional stylistic rules that require type information.

Example setup using @typescript-eslint/parser and @typescript-eslint/plugin as well as typed versions of both strict and stylistic:

/** @type {import("eslint").Linter.Config} */
const config = {
  parser: '@typescript-eslint/parser',
  parserOptions: {
    project: true,
  },
  plugins: ['@typescript-eslint'],
  extends: [
    'eslint:recommended',
    'plugin:@typescript-eslint/strict-type-checked',
    'plugin:@typescript-eslint/stylistic-type-checked',
    'next/core-web-vitals',
    'prettier',
  ],
};

module.exports = config;