-
Notifications
You must be signed in to change notification settings - Fork 61
Add option ignoreFiles to filter fileTypes #267
Conversation
Hi, it seems you are failing some unit tests at the moment? Could you please make sure those pass, and then someone will try and get to reviewing this :) |
src/index.js
Outdated
@@ -14,7 +15,8 @@ const errorWasThrown = {} | |||
const DEFAULT_OPTIONS = { | |||
moduleName: 'styled-components', | |||
importName: 'default', | |||
strict: false | |||
strict: false, | |||
ignoreFiles: [] | |||
} | |||
|
|||
module.exports = options => ({ |
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.
Tests fail due to options
is not normalized. A simple adjustment can be,
const processerFactory = options => ({
... ...
});
module.exports = (options) => processerFactory(Object.assign({}, DEFAULT_OPTIONS, options));
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'm not sure what you mean by the processerFactory
function.
But I mapped the options now and the tests are green
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.
processerFactory
means the whole original codes, and please forgive my typo. It should be processorFactory
or realProcessor
. If writing in this way, you can handle options in the unique place.
const realProcessor = options => ({
code() {},
result() {}
});
module.exports = (options) => realProcessor(Object.assign({}, DEFAULT_OPTIONS, options));
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.
@schoenwaldnils Looks like we are almost there. Would you mind processing options like above and squashing commits to less than or equal to 3? Thanks for your work in advance.
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.
Now I understood what you meant with the processing ^^
Done
Hi. Is there any documentation for this? The syntax @schoenwaldnils suggests in #187 (comment) doesn't seem to work for me. Cheers |
@tomdev10 Check #272. Notice items in config |
Adding option
ignoreFiles
to filter file types.In my case this way I can filter
*.css
files to use the processor only injs, jsx
files.Solves #187.