-
Notifications
You must be signed in to change notification settings - Fork 52
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
fix: use pure ES modules at the monorepo top level #3970
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
'use strict' | ||
|
||
const { overrides } = require('@netlify/eslint-config-node') | ||
|
||
module.exports = { | ||
extends: ['plugin:fp/recommended', '@netlify/eslint-config-node'], | ||
parserOptions: { | ||
sourceType: 'module', | ||
}, | ||
rules: { | ||
strict: 2, | ||
|
||
|
@@ -54,32 +55,17 @@ module.exports = { | |
], | ||
}, | ||
], | ||
'import/extensions': [2, 'ignorePackages'], | ||
}, | ||
overrides: [ | ||
...overrides, | ||
{ | ||
files: ['**/tests.{cjs,mjs,js}', '**/tests/**/*.{cjs,mjs,js}'], | ||
rules: { | ||
'node/no-missing-import': 0, | ||
}, | ||
}, | ||
{ | ||
files: ['**/fixtures/**/*.{cjs,mjs,js}'], | ||
rules: { | ||
'import/no-unresolved': 0, | ||
'node/no-missing-import': 0, | ||
}, | ||
}, | ||
{ | ||
files: ['**/fixtures/**/*edge-handlers*/**/*.js', '**/fixtures/*es_module*/**/*.js'], | ||
parserOptions: { | ||
sourceType: 'module', | ||
}, | ||
rules: { | ||
'node/no-unsupported-features/es-syntax': 0, | ||
'ava/no-import-test-files': 0, | ||
}, | ||
}, | ||
|
||
// @todo As it stands, this rule is problematic with methods that get+send | ||
// many parameters, such as `runStep` in `src/steps/run_step.js`. | ||
// We should discuss whether we want to keep this rule or discontinue it. | ||
|
@@ -123,30 +109,5 @@ module.exports = { | |
'import/no-anonymous-default-export': 0, | ||
}, | ||
}, | ||
|
||
{ | ||
files: ['packages/*/tests/**/*.{cjs,mjs,js}'], | ||
rules: { | ||
'no-magic-numbers': 'off', | ||
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. Re-enable this rule since only a few statements were offending. |
||
}, | ||
}, | ||
|
||
// Those packages are using pure ES modules | ||
{ | ||
files: [ | ||
'packages/build/**/*.{cjs,mjs,js}', | ||
'packages/cache-utils/**/*.{cjs,mjs,js}', | ||
'packages/config/**/*.{cjs,mjs,js}', | ||
'packages/functions-utils/**/*.{cjs,mjs,js}', | ||
'packages/git-utils/**/*.{cjs,mjs,js}', | ||
'packages/run-utils/**/*.{cjs,mjs,js}', | ||
], | ||
parserOptions: { | ||
sourceType: 'module', | ||
}, | ||
rules: { | ||
'import/extensions': [2, 'ignorePackages'], | ||
}, | ||
}, | ||
], | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
'use strict' | ||
|
||
module.exports = { extends: ['@commitlint/config-conventional'] } |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
"private": true, | ||
"version": "0.0.0", | ||
"description": "Netlify build module", | ||
"main": "index.js", | ||
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. The top-level |
||
"type": "module", | ||
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. That's the main change. |
||
"author": "Netlify Inc.", | ||
"scripts": { | ||
"test": "run-s format test:dev", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[[plugins]] | ||
package = "./plugin" | ||
package = "./plugin.cjs" | ||
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. Some test files must be renamed to |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[[plugins]] | ||
package = "./plugin" | ||
package = "./plugin.cjs" |
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.
The ESLint configuration can be simplified in several ways, now that every package is using pure ES modules.