-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to flat config #86
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
'use strict'; | ||
const path = require('path'); | ||
const confusingBrowserGlobals = require('confusing-browser-globals'); | ||
import globals from 'globals'; | ||
import confusingBrowserGlobals from 'confusing-browser-globals'; | ||
import eslintConfigXo from './index.js'; | ||
|
||
module.exports = { | ||
extends: path.join(__dirname, 'index.js'), | ||
env: { | ||
node: false, | ||
browser: true, | ||
}, | ||
rules: { | ||
'no-restricted-globals': [ | ||
'error', | ||
...confusingBrowserGlobals, | ||
], | ||
const [config] = eslintConfigXo; | ||
|
||
export default [ | ||
{ | ||
...config, | ||
languageOptions: { | ||
...config.languageOptions, | ||
globals: { | ||
...globals.es2021, | ||
...globals.browser, | ||
}, | ||
}, | ||
rules: { | ||
...config.rules, | ||
'no-restricted-globals': [ | ||
'error', | ||
...confusingBrowserGlobals, | ||
], | ||
}, | ||
}, | ||
}; | ||
]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {default} from './index.js'; |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,19 @@ | ||||||||||||||||||||||||
import eslintConfigXoBrowser from './browser.js'; | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
const [config] = eslintConfigXoBrowser; | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
export default [ | ||||||||||||||||||||||||
{ | ||||||||||||||||||||||||
...config, | ||||||||||||||||||||||||
rules: { | ||||||||||||||||||||||||
...config.rules, | ||||||||||||||||||||||||
indent: [ | ||||||||||||||||||||||||
Comment on lines
+5
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the benefit of this over having the space config be its own config? The latter is what I opted for in
Suggested change
I would do something like: import base from './configs/base.js';
import browser from './configs/browser.js';
import space from './configs/space.js';
export default [
base,
browser,
space,
]; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A benefit of having them as separate (+ including names for each one of them) is that its very clear which config that leads to which config. See example here from the config inspector generated for neostandard: https://neostandard.github.io/neostandard/configs |
||||||||||||||||||||||||
'error', | ||||||||||||||||||||||||
2, | ||||||||||||||||||||||||
{ | ||||||||||||||||||||||||
SwitchCase: 1, | ||||||||||||||||||||||||
}, | ||||||||||||||||||||||||
], | ||||||||||||||||||||||||
}, | ||||||||||||||||||||||||
}, | ||||||||||||||||||||||||
]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import eslintConfigXo from './index.js'; | ||
|
||
const [config] = eslintConfigXo; | ||
|
||
export default [ | ||
{ | ||
...config, | ||
rules: { | ||
...config.rules, | ||
indent: [ | ||
'error', | ||
2, | ||
{ | ||
SwitchCase: 1, | ||
}, | ||
], | ||
}, | ||
}, | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opted for a
neostandard({ semi: true })
style to construct the config inneostandard
. Have you considered doing that instead of/browser
? Having something likeexport default xo({ browser: true })
?That way you can have
space
,browser
etc exposed without having to have files for the combinations as well, likespace/browser