-
Notifications
You must be signed in to change notification settings - Fork 87
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
Feat(#31): Add ignore option #37
Conversation
Thank you for the PR. This lack documentation, |
src/utilities/log.js
Outdated
@@ -2,8 +2,6 @@ import chalk from 'chalk'; | |||
import moment from 'moment'; | |||
|
|||
export default (...append) => { | |||
/* eslint-disable no-console */ | |||
/* eslint-disable no-console */ |
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.
Use // eslint-disable-next-line
src/utilities/constants.js
Outdated
@@ -0,0 +1,3 @@ | |||
const CREATE_INDEX_PATTERN = /(?:^|[\n\r]+)\/\/ @create-index\s?({.*})?[\n\r]+/; |
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.
export const CREATE_INDEX_PATTERN ...
package.json
Outdated
@@ -48,7 +48,8 @@ | |||
"create-index": "node ./dist/bin/create-index ./src/utilities", | |||
"lint": "cross-env NODE_ENV=development eslint ./src ./tests", | |||
"precommit": "npm run test", | |||
"test": "npm run build && npm run lint && cross-env NODE_ENV=development mocha --compilers js:babel-register" | |||
"test": "npm run build && npm run lint && cross-env NODE_ENV=development mocha --compilers js:babel-register", | |||
"test:watch": "cross-env NODE_ENV=development mocha --watch --reporter spec --bail --compilers js:babel-register" |
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.
Remove test:watch
.
test/writeIndex.js
Outdated
writeIndex([path.resolve(fixturesPath, 'mixed')]); | ||
it('creates index with config in target directory', () => { | ||
const indexFilePath = path.resolve(fixturesPath, 'with-config/index.js'); | ||
const ignoredExportLine = `export { default as bar } from './bar.js';`; // eslint-disable-line quotes |
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.
Use // eslint-disable-next-line
test/writeIndex.js
Outdated
}; | ||
|
||
const appendToFile = (filePath, content) => { | ||
try { |
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.
Whats the reason for swallowing an error?
test/writeIndex.js
Outdated
|
||
const removeFileByPath = (filePath) => { | ||
// eslint-disable-next-line no-empty | ||
try { |
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.
Whats the reason for swallowing an error?
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 was trying to follow "code style" in the project so if you look here https://github.com/gajus/create-index/pull/37/files#diff-f546cc5537a07f2741198b32e7ef3aa9L17 the same pattern with swallowing an error has been already used. I decided to just copy and use it.
Anyway I will remove them if you want, no problem :)
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.
Oh, thats in the test/
. Meh, I am indifferent.
src/utilities/readIndexConfig.js
Outdated
import hasIndex from './hasIndex'; | ||
import {CREATE_INDEX_PATTERN} from './constants'; | ||
|
||
const isString = (str) => { |
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.
Remove unnecessary helpers. I am all pro declarative programming, though typeof str === 'string'
is already achieving the same.
src/utilities/readIndexConfig.js
Outdated
}; | ||
|
||
const isEmptyString = (str) => { | ||
return str.length === 0; |
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.
Remove unnecessary helpers. I am all pro declarative programming, though str.length
is already achieving the same.
5e170c1
to
b162c74
Compare
Sorry for so many changes. I applied all requested changes and removed "swallowing errors" from tests. I added also section about |
Is this ready to be merged? |
- Add functionality to ignore files based on provided regular expressions - Support writeIndex and writeIndexCli - in index.js config must be specified as below // @create-index {"ignore":["/foo.js"]}
b162c74
to
2e2e7eb
Compare
I thought that I also checked this PR on my local project where I use Please feel free to correct any english language issues. |
Thank you |
This commit add functionality to ignore files
based on provided regexps.
in index.js config must be specified as below
// @create-index {"ignore":["/foo.js"]}