How to use @strv/eslint-config-base - 6 common examples

To help you get started, we’ve selected a few @strv/eslint-config-base examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strvcom / code-quality-tools / packages / eslint-config-node / index.js View on Github external
},

  env: {
    es6: true,
    node: true,
  },

  plugins: [
    'node',
  ],

  settings: {
    'import/resolver': {
      node: {
        extensions: [
          ...base.settings['import/resolver'].node.extensions,
          '.node',
        ],
      },
    },
  },

  rules: {
    // Enforce `require()` on the top-level module scope
    // It's arguably harder to identify dependencies when they are deeply nested inside of functions
    // and other statements. Since require() does a synchronous load, it can cause performance
    // problems when used in other locations.
    'global-require': 'warn',

    // Disallow use of the deprecated Buffer() constructor
    // In Node.js, the behavior of the Buffer constructor is different depending on the type of its
    // argument. Passing an argument from user input to Buffer() without validating its type can
github strvcom / code-quality-tools / packages / eslint-config-typescript / index.js View on Github external
const base = require('@strv/eslint-config-base')

module.exports = {

  extends: require.resolve('@strv/eslint-config-base'),

  settings: {
    // Correctly recognise .ts and .d.ts files when checking import paths against the filesystem
    'import/resolver': {
      node: {
        extensions: [
          '.ts',
          '.tsx',
          '.d.ts',
          ...base.settings['import/resolver'].node.extensions,
        ],
      },
    },
  },

  parser: '@typescript-eslint/parser',

  parserOptions: {
    ecmaVersion: 2018,
    sourceType: 'module',
  },

  plugins: [
    '@typescript-eslint',
  ],
github strvcom / code-quality-tools / packages / eslint-config-react / index.js View on Github external
sourceType: 'module',
    ecmaFeatures: {
      jsx: true,
    },
  },

  settings: {
    react: {
      version: 'detect',
    },

    'import/resolver': {
      node: {
        extensions: [
          '.jsx',
          ...base.settings['import/resolver'].node.extensions,
        ],
      },
    },
  },

  /* eslint-disable max-len */
  rules: {
    // Enforces consistent naming for boolean props
    // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/boolean-prop-naming.md
    'react/boolean-prop-naming': [
      'warn',
      {
        rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+',
        message:
          'Boolean prop: ({{ propName }}) should start with is/has - pattern: ({{ pattern }})',
      },
github strvcom / code-quality-tools / packages / eslint-config-node / index.js View on Github external
'node/shebang': 'warn',

    // Disallow deprecated API
    // Node has many deprecated API. The community is going to remove those API from Node in future,
    // so we should not use those.
    'node/no-deprecated-api': 'warn',
  },

  overrides: [{
    files: globs.javascripts,

    parserOptions: {
      sourceType: 'script',
    },
  }, {
    files: globs.esmodules,

    parserOptions: {
      sourceType: 'module',
    },

    env: {
      es6: true,
    },

    rules: {
      // Report modules without any exports & individual exports not being statically imported or
      // requireed from other modules in the same project
      'import/no-unused-modules': ['warn', {
        missingExports: true,
        unusedExports: true,
      }],
github strvcom / code-quality-tools / packages / eslint-config-node / index.js View on Github external
'node/process-exit-as-throw': 'error',

    // Suggest correct usage of shebang
    // This rule checks bin field of package.json, then if a target file matches one of bin files,
    // it checks whether or not there is a correct shebang. Otherwise it checks whether or not there
    // is not a shebang.
    'node/shebang': 'warn',

    // Disallow deprecated API
    // Node has many deprecated API. The community is going to remove those API from Node in future,
    // so we should not use those.
    'node/no-deprecated-api': 'warn',
  },

  overrides: [{
    files: globs.javascripts,

    parserOptions: {
      sourceType: 'script',
    },
  }, {
    files: globs.esmodules,

    parserOptions: {
      sourceType: 'module',
    },

    env: {
      es6: true,
    },

    rules: {
github strvcom / code-quality-tools / packages / eslint-config-mocha / index.js View on Github external
/**
 * strvcom/eslint-config-mocha
 *
 * @author      Robert Rossmann 
 * @copyright   2019 STRV
 * @license     http://choosealicense.com/licenses/bsd-3-clause  BSD-3-Clause License
 */

'use strict'

const globs = require('@strv/eslint-config-base/globs')

module.exports = {

  overrides: [{
    files: globs.tests,

    plugins: [
      'mocha',
    ],

    env: {
      mocha: true,
    },

    rules: {
      // Set Maximum Depth of Nested Callbacks
      // This rule is aimed at increasing code clarity by discouraging deeply nesting callbacks.
      // Allow some extra nesting for Mocha tests, due to Mocha's test coding patterns encouraging
      // some extra callback nesting.
      'max-nested-callbacks': ['warn', 6],

@strv/eslint-config-base

STRV's ESLint configuration preset

BSD-3-Clause
Latest version published 9 months ago

Package Health Score

65 / 100
Full package analysis