github.com/SmartMeshFoundation/Spectrum@v0.0.0-20220621030607-452a266fee1e/dashboard/assets/.eslintrc (about)

     1  // Copyright 2017 The Spectrum Authors
     2  // This file is part of the Spectrum library.
     3  //
     4  // The Spectrum library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The Spectrum library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the Spectrum library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  // React syntax style mostly according to https://github.com/airbnb/javascript/tree/master/react
    18  {
    19      'env': {
    20          'browser': true,
    21          'node':    true,
    22          'es6':     true,
    23      },
    24      'parser': 'babel-eslint',
    25      'parserOptions': {
    26          'sourceType':   'module',
    27          'ecmaVersion':  6,
    28          'ecmaFeatures': {
    29              'jsx': true,
    30          }
    31      },
    32      'extends': 'airbnb',
    33      'plugins': [
    34          'flowtype',
    35          'react',
    36      ],
    37      'rules': {
    38          'no-tabs':                'off',
    39          'indent':                 ['error', 'tab'],
    40          'react/jsx-indent':       ['error', 'tab'],
    41          'react/jsx-indent-props': ['error', 'tab'],
    42          'react/prefer-stateless-function': 'off',
    43  
    44          // Specifies the maximum length of a line.
    45          'max-len': ['warn', 120, 2, {
    46              'ignoreUrls':             true,
    47              'ignoreComments':         false,
    48              'ignoreRegExpLiterals':   true,
    49              'ignoreStrings':          true,
    50              'ignoreTemplateLiterals': true,
    51          }],
    52          // Enforces spacing between keys and values in object literal properties.
    53          'key-spacing': ['error', {'align': {
    54              'beforeColon': false,
    55              'afterColon':  true,
    56              'on':          'value'
    57          }}],
    58          // Prohibits padding inside curly braces.
    59          'object-curly-spacing': ['error', 'never'],
    60          'no-use-before-define': 'off', // messageAPI
    61          'default-case': 'off',
    62  
    63          'flowtype/boolean-style':                  ['error', 'boolean'],
    64          'flowtype/define-flow-type':               'warn',
    65          'flowtype/generic-spacing':                ['error', 'never'],
    66          'flowtype/no-primitive-constructor-types': 'error',
    67          'flowtype/no-weak-types':                  'error',
    68          'flowtype/object-type-delimiter':          ['error', 'comma'],
    69          'flowtype/require-valid-file-annotation':  'error',
    70          'flowtype/semi':                           ['error', 'always'],
    71          'flowtype/space-after-type-colon':         ['error', 'always'],
    72          'flowtype/space-before-generic-bracket':   ['error', 'never'],
    73          'flowtype/space-before-type-colon':        ['error', 'never'],
    74          'flowtype/union-intersection-spacing':     ['error', 'always'],
    75          'flowtype/use-flow-type':                  'warn',
    76          'flowtype/valid-syntax':                   'warn',
    77      },
    78      'settings': {
    79          'flowtype': {
    80              'onlyFilesWithFlowAnnotation': true,
    81          }
    82      },
    83  }