Giter Site home page Giter Site logo

eslint-config's Introduction

ESLint Config

npm

A set of predefined ESLint config.

Usage

To use this package, ESLint should be configured by an file named eslint.config.js, since we are using ESLint's flat config.

  • Basic usage:

    export { config as default } from '@arianrhodsandlot/eslint-config'

    or

    export { default } from '@arianrhodsandlot/eslint-config'
  • For CommonJS environment:

    module.exports = require('@arianrhodsandlot/eslint-config').config
  • Advanced usage:

    Expand / Collapse
    • Use the more powerful function createConfig
      • createConfig is a smart function that can detect should TS rules be enabled or which libraries-related plugins/rules should be + added:

        import { createConfig } from '@arianrhodsandlot/eslint-config'
        
        export default createConfig()
      • Since flat config is actually an array, we can append more config items to it:

        import { createConfig } from '@arianrhodsandlot/eslint-config'
        
        export default createConfig({
          append: {
            files: ['**/*.html'],
            plugins: {
              html: eslintHtmlPlugin,
            },
            rules: eslintHtmlPlugin.configs.recommended.rules,
          },
          prepend: {
            ignore: ['build/**/*']
          },
        })
      • Additional plugins/rules can be explictly enabled or disabled:

        import { createConfig } from '@arianrhodsandlot/eslint-config'
        
        export default createConfig({
          markdown: false,
          next: true,
          prettier: false,
          react: true,
          rules: {
            eqeqeq: 'off',
          },
        })

        The full list of options are listed below.

        export interface CreateConfigOptions {
          /** Append custom flat configs to default */
          append?: FlatConfig | FlatConfigs
        
          /** Should eslint-plugin-compat be enabled */
          compat?: boolean
        
          /** Should eslint-plugin-diff be enabled */
          diff?: boolean
        
          /** Should eslint-plugin-eslint-comments be enabled */
          eslintComments?: boolean
        
          /** Should eslint-plugin-import be enabled */
          import?: boolean
        
          /** Should eslint-plugin-jsdoc be enabled */
          jsdoc?: boolean
        
          /** Should eslint-plugin-markdown be enabled */
          markdown?: boolean
        
          /** Should eslint-plugin-n be enabled */
          n?: boolean
        
          /** Should \@next/eslint-plugin-next be enabled */
          next?: boolean
        
          /** Should eslint-plugin-perfectionist be enabled */
          perfectionist?: boolean
        
          /** Append custom flat configs to default */
          prepend?: FlatConfig | FlatConfigs
        
          /** Should eslint-plugin-prettier be enabled */
          prettier?: boolean
        
          /** Should eslint-plugin-promise be enabled */
          promise?: boolean
        
          /** Should eslint-plugin-react, eslint-plugin-jsx-a11y, eslint-plugin-react-hooks, eslint-plugin-react-refresh be enabled */
          react?: boolean
        
          /** Should eslint-plugin-regexp be enabled */
          regexp?: boolean
        
          /** Custom rules */
          rules?: FlatConfigRules
        
          /** Should eslint-plugin-security be enabled */
          security?: boolean
        
          /** Should eslint-plugin-sonarjs be enabled */
          sonarjs?: boolean
        
          /** Should eslint-plugin-tsdoc be enabled */
          tsdoc?: boolean
        
          /** Should \@typescript-eslint/eslint-plugin be enabled */
          typescript?: boolean
        
          /** Should eslint-plugin-unicorn be enabled */
          unicorn?: boolean
        
          /** Should eslint-plugin-vue, eslint-plugin-vuejs-accessibility, eslint-plugin-vue-scoped-css be enabled */
          vue?: boolean
        }

Features

License

MIT

eslint-config's People

Contributors

arianrhodsandlot avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.