1.1.1 • Published 1 year ago

eslint-plugin-nextjs-rules v1.1.1

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

eslint-plugin-nextjs-rules

Some nifty Next.js ESLint rules

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-nextjs-rules:

npm install eslint-plugin-nextjs-rules --save-dev

Usage

Add eslint-plugin-nextjs-rules to the plugins section of your .eslintrc configuration file.

{
  "plugins": ["eslint-plugin-nextjs-rules"]
}

Then configure the rules you want to use under the rules table further down in this ReadMe

// .eslintrc
module.exports = {
  plugins: [..., "nextjs-rules", ...],
  rules: {
    ...
    "nextjs-rules/no-get-server-side-props": [
      "error",
      {
        files: [
          // pages where you don't want getServerSideProps() used at all
          `${__dirname}/src/pages/index.tsx`,
          `${__dirname}/src/pages/something-went-wrong.tsx`,
          `${__dirname}/src/pages/our-products/[product].tsx`,
          `${__dirname}/src/pages/faq/index.tsx`
        ]
      }
    ]
    ...
  }
}

Rules

This table is generated by eslint-doc-generator

Name                    Description
no-get-server-side-propsDisallow usage of getServerSideProps method in a given list of files to enforce static rendering
1.1.1

1 year ago

1.1.0

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.0

1 year ago