Skip to content

Commit

Permalink
feat(@nft-team/eslint-config): eslint config import 정렬 업데이트 및 문서 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
saseungmin committed Jul 11, 2023
1 parent 4a3b44a commit b924681
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 6 deletions.
28 changes: 27 additions & 1 deletion packages/eslint/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 🚧 WIP 🚧 @nft-team/eslint-config
# @nft-team/eslint-config

<a href="https://github.com/mbti-nf-team/frontend-libraries/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc">
<img src="https://img.shields.io/github/issues/mbti-nf-team/frontend-libraries?style=flat-square" />
Expand Down Expand Up @@ -38,6 +38,32 @@ module.exports = {

[View more extensions..](https://github.com/mbti-nf-team/frontend-libraries/blob/main/packages/eslint/index.js)

### 👉 Sort default imports
This is the default value for the `groups` option:

```js
[
// Side effect imports.
['^\\u0000'],
// Node.js builtins. You could also generate this regex if you use a `.js` config.
// For example: `^(${require("module").builtinModules.join("|")})(/|$)`
// OR Node.js builtins prefixed with `node:`.
['^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)', '^node:'],
// Packages. `react` related packages
['^react'],
// Packages. Things that start with a letter (or digit or underscore), or `@` followed by a letter.
['^@?\\w'],
// Parent imports. Put `..` last.
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
// Other relative imports. Put same-folder imports and `.` last.
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
// Svg file imports.
['^.+\\.svg$'],
// Style imports.
['^.+\\.s?css$'],
]
```

## 🐛 Bug reporting
[Issues](https://github.com/mbti-nf-team/frontend-libraries/issues)

Expand Down
19 changes: 14 additions & 5 deletions packages/eslint/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
module.exports = {
env: {
es6: true,
browser: true,
},
extends: [
'airbnb',
'eslint:recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
'plugin:react/jsx-runtime',
'plugin:@next/next/recommended',
],
plugins: [
'simple-import-sort',
'unused-imports',
],
ignorePatterns: [
'node_modules/',
'.pnp.cjs',
'.pnp.loader.cjs',
'public/',
'.yarn/',
'dist/',
],
parserOptions: {
ecmaFeatures: {
jsx: true,
Expand Down Expand Up @@ -41,12 +52,10 @@ module.exports = {
rules: {
'simple-import-sort/imports': ['error', {
groups: [
['^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)'],
['^\\u0000'],
['^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)', '^node:'],
['^react'],
['^next'],
['^@?\\w'],
['^(@|@company|@ui|components|utils|config|vendored-lib)(/.*|$)'],
['^\\u0000'],
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
['^.+\\.svg$'],
Expand Down

0 comments on commit b924681

Please sign in to comment.