1.1.0 • Published 6 years ago

import-sort-style-fengk v1.1.0

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

import-sort-style-fengk

why to create this

  • to verify my own code since no satisfied tools found in eslint plugins. (Maybe eslint-plugin-import is great, but couldn't auto fix)

how it work

  1. this is based on import-sort. You may need to create a .importsortrc file in your working directory just like this:
{
    ".js, .jsx": {
        "parser": "babylon",
        "style": "fengk"
    }
}
  1. npm i import-sort-style-fengk --save-dev or just put this package into your node_modules instead of writing dependencies into your package.json

result

// Modules from the Node.js "standard" Library sorted by name
import { readFile, writeFile } from 'fs'
import path from 'path'

// Modules about React
import React from 'react'
import ReactDOM from 'react-dom'
import { Button } from 'antd'

// Absolute modules with side effects(not styled modules)
import 'a'
import 'b'

// Absolute modules from third-party modules
import aa from 'aa'
import bb from 'bb'

// Relative modules sorted by "relative depth" and then by name
import aaa from '././aaa'
import bbb from '././bbb'
import aaaa from './a'
import bbbb from './b'

// Absolute styled modules
import 'index.css'

// Firts-party styled modules
import styles from "./index.css"

other

  • Thanks for using or referencing. The best way to write your own style is to look at existing styles like this style or the orgin author's style