Skip to content

Commit e01865a

Browse files
authored
Merge pull request #219 from humanmade/import
ESLint: Add and configure import plugin
2 parents aae4870 + 2856040 commit e01865a

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* eslint-disable no-unused-vars */
2+
3+
import apiFetch from '@wordpress/api-fetch';
4+
import chalk from 'chalk';
5+
import eslint from 'eslint';
6+
import path from 'path';
7+
import './';
8+
import Test from './component-jsx-parentheses';
9+
import './style.scss';
10+
import index from '../../index';
11+
import '../test-lint-config';
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* eslint-disable no-unused-vars */
2+
3+
import path from 'path';
4+
5+
import chalk from 'chalk';
6+
import eslint from 'eslint';
7+
8+
import apiFetch from '@wordpress/api-fetch';
9+
10+
import index from '../../index';
11+
import '../test-lint-config';
12+
13+
import Test from './component-jsx-parentheses';
14+
15+
import './';
16+
import './style.scss';

packages/eslint-config-humanmade/index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports = {
77
'extends': [
88
'eslint:recommended',
99
'react-app',
10+
'plugin:import/errors',
1011
'plugin:jsdoc/recommended',
1112
'plugin:react-hooks/recommended',
1213
],
@@ -40,6 +41,23 @@ module.exports = {
4041
'eol-last': [ 'error', 'unix' ],
4142
'eqeqeq': [ 'error' ],
4243
'func-call-spacing': [ 'error' ],
44+
'import/no-unresolved': [ 'off' ],
45+
'import/order': [ 'error', {
46+
'alphabetize': {
47+
'order': 'asc',
48+
'caseInsensitive': true
49+
},
50+
'groups': [ 'builtin', 'external', 'parent', 'sibling', 'index' ],
51+
'newlines-between': 'always',
52+
'pathGroups': [
53+
{
54+
'pattern': '@wordpress/**',
55+
'group': 'external',
56+
'position': 'after'
57+
}
58+
],
59+
'pathGroupsExcludedImportTypes': [ 'builtin' ]
60+
} ],
4361
'indent': [ 'error', 'tab', {
4462
'SwitchCase': 1,
4563
} ],

0 commit comments

Comments
 (0)