Skip to content

Commit

Permalink
- Linting: Ignore ignore for linting
Browse files Browse the repository at this point in the history
- Testing: Ignore `ignore` for nyc coverage
- Build: Avoid Rollup `external` warnings
  • Loading branch information
Brett Zamir committed Jan 14, 2021
1 parent 7e61956 commit b17e491
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 2,5 @@ node_modules
dist
docs/ts
coverage
ignore
!*.js
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 117,7 @@
"dist",
"demo",
"docs",
"ignore",
"test",
"test-helpers"
]
Expand Down
19 changes: 15 additions & 4 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 12,20 @@ import pkg from './package.json';
* @param {PlainObject} config
* @param {string} config.input
* @param {boolean} config.minifying
* @param {string[]} [config.external]
* @param {string} [config.environment=""]
* @param {string} [config.format="umd"]
* @returns {external:RollupConfig}
*/
function getRollupObject ({
input, minifying, environment, format = 'umd'
input, minifying, environment,
// eslint-disable-next-line no-shadow
external,
format = 'umd'
}) {
const nonMinified = {
input,
external,
output: {
format,
sourcemap: minifying,
Expand Down Expand Up @@ -63,9 68,15 @@ function getRollupObject ({
function getRollupObjectByEnv ({minifying, environment}) {
const input = `src/jsonpath-${environment}.js`;
if (environment === 'node') {
// eslint-disable-next-line no-shadow
const external = ['vm'];
return [
getRollupObject({input, minifying, environment, format: 'cjs'}),
getRollupObject({input, minifying, environment, format: 'esm'})
getRollupObject({
input, minifying, environment, external, format: 'cjs'
}),
getRollupObject({
input, minifying, environment, external, format: 'esm'
})
];
}
return [
Expand All @@ -74,7 85,7 @@ function getRollupObjectByEnv ({minifying, environment}) {
];
}

// eslint-disable-next-line import/no-anonymous-default-export
// eslint-disable-next-line import/no-anonymous-default-export -- Rollup config
export default [
...getRollupObjectByEnv({minifying: false, environment: 'node'}),
// ...getRollupObjectByEnv({minifying: true, environment: 'node'}),
Expand Down

0 comments on commit b17e491

Please sign in to comment.