Site Tools


javascript:eslint
npx install-peerdeps --dev eslint-config-airbnb-base
npm i -D eslint-config-prettier prettier eslint-plugin-prettier eslint-plugin-node babel-eslint
.eslintrc.js
module.exports = {
  parser: 'babel-eslint',
 
  env: {
    commonjs: true,
    jest: true,
    es6: true,
    node: true,
    browser: true,
  },
  extends: ['plugin:node/recommended', 'airbnb-base', 'plugin:prettier/recommended'],
  plugins: ['prettier'],
  rules: {
    'prettier/prettier': ['error'],
    'no-undef': 'error',
    'no-unused-vars': 'warn',
    'no-console': 'off',
  },
};
prettier.config.js
module.exports = {
  $schema: 'http://json.schemastore.org/prettierrc',
  arrowParens: 'always',
  printWidth: 88,
  singleQuote: true,
  tabWidth: 2,
  trailingComma: 'all',
  overrides: [
    {
      files: ['*.yaml', '*.yml'],
      options: {
        singleQuote: false,
      },
    },
  ],
};
.editorconfig
[*.{js,ts}]
charset = utf-8
indent_style = space
indent_size = 2
 
[Makefile]
indent_style = tab
 
[*.{json,yaml,yml}]
indent_style = space
indent_size = 2
javascript/eslint.txt · Last modified: 12 May 20 by dcai