Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This refactoring aims to make the codebase around the internal API more consistent. Our codebase is mostly FP style, so the OOP-like code using `.bind()` seems inconsistent to me. Also, the dependency between the internal modules seems implicit through `.bind()`.
- Loading branch information
1 parent
d402889
commit cb425cb
Showing
11 changed files
with
101 additions
and
110 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
|
||
const createStylelint = require('../createStylelint'); | ||
const getConfigForFile = require('../getConfigForFile'); | ||
const pluginWarnAboutFoo = require('./fixtures/plugin-warn-about-foo'); | ||
|
||
test('augmented config loads', async () => { | ||
const stylelint = createStylelint(); | ||
const filepath = path.join(__dirname, 'fixtures/getConfigForFile/a/b/foo.css'); | ||
|
||
await expect(getConfigForFile(stylelint, filepath)).resolves.toEqual({ | ||
config: { | ||
plugins: [path.join(__dirname, '/fixtures/plugin-warn-about-foo.js')], | ||
rules: { | ||
'block-no-empty': [true], | ||
'plugin/warn-about-foo': ['always'], | ||
}, | ||
pluginFunctions: { | ||
'plugin/warn-about-foo': pluginWarnAboutFoo.rule, | ||
}, | ||
}, | ||
filepath: path.join(__dirname, 'fixtures/getConfigForFile/a/.stylelintrc'), | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
const createStylelint = require('../createStylelint'); | ||
const isPathIgnored = require('../isPathIgnored'); | ||
|
||
test('isPathIgnored()', async () => { | ||
const config = { | ||
ignoreFiles: ['**/*.css', '!**/invalid-hex.css'], | ||
rules: { 'block-no-empty': true }, | ||
}; | ||
const stylelint = createStylelint({ config }); | ||
|
||
await expect( | ||
Promise.all([ | ||
isPathIgnored(stylelint, 'a.css'), | ||
isPathIgnored(stylelint, 'foo/bar/baz.css'), | ||
isPathIgnored(stylelint, 'foo/bar/baz.scss'), | ||
isPathIgnored(stylelint, 'foo/invalid-hex.css'), | ||
]), | ||
).resolves.toEqual([true, true, false, false]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters