#atom

Shareable and customizable rule sets for JavaScript and TypeScript linting

Core Idea: ESLint configurations are collections of rules and settings that define code style and quality standards, which can be shared, extended, and customized across projects to ensure consistent development practices.

Key Elements

// Comprehensive .eslintrc.js example
module.exports = {
  root: true,
  env: {
    browser: true,
    node: true,
    es2022: true,
  },
  extends: [
    'eslint:recommended',
    'plugin:react/recommended',
    'plugin:@typescript-eslint/recommended',
  ],
  parser: '@typescript-eslint/parser',
  parserOptions: {
    ecmaVersion: 'latest',
    sourceType: 'module',
    ecmaFeatures: {
      jsx: true,
    },
  },
  plugins: [
    'react',
    '@typescript-eslint',
    'import',
  ],
  rules: {
    'no-console': 'warn',
    'react/prop-types': 'off',
    'import/order': ['error', {
      'groups': ['builtin', 'external', 'internal'],
      'newlines-between': 'always',
      'alphabetize': { 'order': 'asc', 'caseInsensitive': true }
    }]
  },
  settings: {
    react: {
      version: 'detect',
    },
  },
  overrides: [
    {
      files: ['*.test.js', '*.spec.js'],
      env: {
        jest: true,
      },
      rules: {
        'no-console': 'off',
      }
    }
  ]
};

Repositories

Connections

References

  1. ESLint Configuration Documentation: https://eslint.org/docs/latest/use/configure/
  2. "Mastering ESLint" by Nicholas C. Zakas
  3. "JavaScript Style Guides and ESLint" by Airbnb Engineering

#eslint #javascript #typescript #code-style #configuration


Connections:


Sources: