Skip to content
This repository was archived by the owner on May 16, 2020. It is now read-only.

Commit eb35d5d

Browse files
feat: add in rules for import plugin and start of configs
1 parent aaf30b6 commit eb35d5d

File tree

6 files changed

+62
-4
lines changed

6 files changed

+62
-4
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
rules: {
3+
'import/core-modules': ['electron'],
4+
}
5+
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/* eslint-disable import/no-commonjs */
2+
3+
module.exports = {
4+
rules: {}
5+
};

packages/eslint-config-atlauncher/index.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
/* eslint-disable filenames/no-index */
2+
/* eslint-disable import/no-commonjs */
3+
4+
const configs = [
5+
'./configs/electron',
6+
'./configs/react'
7+
].map(require.resolve);
28

39
const rules = [
410
'./rules/base',
5-
'./rules/filenames'
11+
'./rules/plugin-filenames',
12+
'./rules/plugin-import'
613
].map(require.resolve);
714

815
module.exports = {
@@ -16,12 +23,12 @@ module.exports = {
1623
],
1724
extends: [
1825
'eslint:recommended',
19-
'plugin:import/recommended',
2026
'plugin:jsx-a11y/recommended',
2127
'plugin:react/recommended',
2228
'plugin:promise/recommended',
2329
...rules
2430
],
31+
configs,
2532
env: {
2633
node: true,
2734
es6: true,
@@ -36,6 +43,5 @@ module.exports = {
3643
experimentalObjectRestSpread: true,
3744
jsx: true
3845
}
39-
},
40-
rules: {}
46+
}
4147
};

packages/eslint-config-atlauncher/rules/base.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable import/no-commonjs */
2+
13
module.exports = {
24
rules: {
35
"no-empty": "off", // this is covered by the 'no-empty-blocks' plugin

packages/eslint-config-atlauncher/rules/filenames.js renamed to packages/eslint-config-atlauncher/rules/plugin-filenames.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable import/no-commonjs */
2+
13
module.exports = {
24
rules: {
35
"filenames/no-index": "error"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/* eslint-disable import/no-commonjs */
2+
3+
module.exports = {
4+
rules: {
5+
// static analysis
6+
'import/no-unresolved': 'error',
7+
'import/named': 'error',
8+
'import/default': 'error',
9+
'import/namespace': 'error',
10+
'import/no-absolute-path': 'error',
11+
12+
// helpful warnings
13+
'import/export': 'error',
14+
'import/no-named-as-default': 'warn',
15+
'import/no-named-as-default-member': 'warn',
16+
'import/no-deprecated': 'warn',
17+
'import/no-extraneous-dependencies': 'error',
18+
'import/no-mutable-exports': 'error',
19+
20+
// module systems
21+
'import/unambiguous': 'warn',
22+
'import/no-commonjs': 'error',
23+
'import/no-amd': 'error',
24+
25+
// style guide
26+
'import/first': ['error', {'absolute-first': true}],
27+
'import/no-duplicates': 'error',
28+
'import/extensions': ['error', 'always', {'js': 'never'}],
29+
'import/order': ['error', {
30+
'newlines-between': 'always',
31+
'groups': [
32+
['external', 'builtin'],
33+
['index', 'sibling', 'parent', 'internal']
34+
]
35+
}],
36+
'import/newline-after-import': ["error", {'count': 1}]
37+
}
38+
};

0 commit comments

Comments
 (0)