ksercs / eslint-config-devextreme

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ESLint Configurations for the DevExtreme Source Code

This repository collects ESLint configurations that enforce the code style used by the DevExtreme development team. These configurations are based on the Airbnb JavaScript Style Guide and cover most frequently encountered cases.

Note: Adding new configurations is possible but discouraged. Double-check that none of the existing configurations fits for your case before you add a new configuration.

List of Configurations

  1. TypeScript
  2. Spell Check
  3. Renovation Declarations
  4. Jest Tests
  5. QUnit Tests
  6. TestCafe Tests

TypeScript

Spell Check

Lists words that the spell check should ignore.

  • Usage Add the following line to your .eslintrc file:

    "extends": ["devextreme/spell-check"]
  • Required plugins

Renovation Declarations

  • Usage Add the following line to your .eslintrc file:

    'extends': ['devextreme/renovation-declarations']
  • Extended configurations

  • Overrides

    • Allow devDependencies to be imported when in development mode:

      'import/no-extraneous-dependencies': ['error', { devDependencies: true }]
    • Allow two classes (component class and props class) in one file:

      'max-classes-per-file': ['error', 2]
    • Disable React dependency validation. Declarations do not require this dependency, since they are not proper React components.

      'react/react-in-jsx-scope': ['off']
    • Allow function calls in the ternary operator.

       '@typescript-eslint/no-unused-expressions': ['error', { 'allowShortCircuit': true, ;'allowTernary': true }]

Jest Tests

  • Usage Add the following line to your .eslintrc file:

    'extends': ['devextreme/jest']
  • Extended configurations

  • Environment

    • node (Node.js global variables and scope)
    • jest (Jest global variables)
  • Required plugins

  • Extended plugins

  • Overrides

    • Allow the use of devDependencies in the tests:

      'import/no-extraneous-dependencies': ['error', { devDependencies: true }]
    • Disable props validation for temporary JSX components created during the tests:

      'react/prop-types': ['error', { skipUndeclared: true }]
    • Allow the use of props spreading in the temporary JSX components:

      'react/jsx-props-no-spreading': 'off'
    • Allow defining the widget's accessKey attribute:

      'jsx-a11y/no-access-key': 'off'

QUnit Tests

  • Usage Add the following line to your .eslintrc file:

    'extends': ['devextreme/qunit']
  • Extended configurations

  • Environment

    • qunit (QUnit global variables)
    • browser (Browser global variables)
  • Required plugins

  • Extended plugins

  • Overrides

    'qunit/no-arrow-tests': 'error',
    'qunit/no-commented-tests': 'error',
    'qunit/no-identical-names': 'warn',
    'qunit/no-global-module-test': 'off',
    'qunit/require-expect': 'off',
    'qunit/resolve-async': 'off'

TestCafe Tests

  • Usage Add the following line to your .eslintrc file:

    'extends': ['devextreme/testcafe']
  • Extended configurations

  • Overrides

    • Allow using any types of dependencies:

      'import/no-extraneous-dependencies': 'off'
    • Allow modifying parameters in event handlers to test these use cases:

      'no-param-reassign': ['error', { 'props': false }],
    • Allow await inside of loops. This is a common case for TestCafe tests.

      'no-await-in-loop': 'off'
  • Environment

    • node (Node.js global variables and scope)
    • browser (Browser global variables)
    • jquery (jQuery global variables)
  • Additional global variables

    • test
    • fixture

About

License:MIT License


Languages

Language:JavaScript 100.0%