1.0.0 • Published 2 years ago

eslint-config-cbl v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

eslint-config-cbl

General ESLint and TypeScript configuration for React and React Native.

Usage

You will need eslint if not already installed:

npm install -D eslint

Install config:

npm install -D eslint-config-cbl

Extend config in .eslintrc.js:

module.exports = { 
    extends: ['eslint-config-cbl'], 
} 

React Navite adaptions

To use the eslint confing with React Native install @react-native-community/eslint-config

npm install -D @react-native-community/eslint-config

Extend .eslintrc.js:

module.exports = {
    extends: ['eslint-config-cbl', '@react-native-community'], 
}

Specific React Native rules that should be added:

{
    rules: {
        'react-native/no-color-literals': 'error',
        'react-native/no-inline-styles': 'error',
        'react-native/no-unused-styles': 'error',
        'react-native/split-platform-components': 1
    }
}

Typescript

The tsconfig for react has to be extended in tsconfig.json:

{
    "extends": "eslint-config-cbl/tsconfig.base"
}

For React Native change jsx value to react-native:

{
    "extends": "eslint-config-cbl/tsconfig.base",
    "compilerOptions": {
        "jsx": "react-native"
    }
}

Used By

This project is used by the following companies:

License

MIT