1.0.1 ā€¢ Published 2 years ago

eslint-config-react-native-ialoig v1.0.1

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

eslint-config-react-native-ialoig github npm

Hi šŸ‘‹

this is an ESLint configuration for React Native developers

šŸš€ Getting Started

Installation

    npm install eslint-config-react-native-ialoig

šŸ“ Rules

indent

ā›”ļø error if not tabbed indentation

quotes

āš ļø warning if not double

semi

ā›”ļø disallows semicolons as the end of statements

curly-spacing

āœ… require spaces between curly braces

sort-imports

ā›”ļø error if not correctly sorted
āœ… ignores the case-sensitivity of the imports local name
āœ… Ignores the sorting of import declaration statements
āœ… Do not ignores the member sorting within a multiple member import declaration
āœ… default member syntax sort order is:
    * `none` - import module without exported bindings
    * `all` - import all members provided by exported bindings
    * `multiple` - import multiple members
    * `single` - import single member

šŸ”Œ Plugins

eslint-plugin-react-native

āœ… detect unused StyleSheet rules in React components
āœ… enforce using platform specific filenames when necessary
āœ… no inline styles in components. 
Styles should be separate from the view layout
āœ… detect color literals in styles. 
Color definitions should be stored in variables instead of hardcoding them inside styles
āœ… all strings should be wrapped with a Text component
āœ… no Single Element Style Arrays are allowed.
These cause unnecessary re-renders as each time the array's identity changes.

eslint-plugin-import

āœ… Ensure imports point to a file/module that can be resolved
āœ… Ensure named imports correspond to a named export in the remote file
āœ… Ensure imported namespaces contain dereferenced properties as they are dereferenced
āœ… Ensure a default export is present, given a default import
āœ… Enforce a convention in module import order
the order is as shown in the following example:

// 1. node "builtin" modules
import fs from 'fs';
import path from 'path';
// 2. "external" modules
import _ from 'lodash';
import chalk from 'chalk';
// 3. "internal" modules
// (if you have configured your path or webpack to handle your internal paths differently)
import foo from 'src/foo';
// 4. modules from a "parent" directory
import foo from '../foo';
import qux from '../../foo/qux';
// 5. "sibling" modules from the same or a sibling's directory
import bar from './bar';
import baz from './bar/baz';
// 6. "index" of the current directory
import main from './';

eslint-plugin-i18n-json

āœ… ICU Message syntax validation
āœ… linting of each JSON translation file
āœ… automatic case-sensitive ascending sort of all keys in the translation file
āœ… compare each translation file's key structure with a reference translation file to ensure consistency

VS Code configuration to auto fix

Create .vscode/settings.json

{
    "editor.formatOnSave": true,
    "eslint.run": "onSave",
    "eslint.alwaysShowStatus": true,
    "eslint.format.enable": true,
}

made with šŸ§  by ialoig