[Bug]: The configuration file schema validation is too loose.
Version
System:
OS: macOS 12.5.1
CPU: (10) arm64 Apple M1 Pro
Memory: 125.14 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Browsers:
Chrome: 115.0.5790.170
Safari: 15.6.1
Details
For example, there is no error report while I use runtime.router in configuration file, but actually I am not install @modern-js/runtime.
So I try to change the initial validate schema to fix it ( may be not appropriate because lead to wider impact), it caused more errors in test cases.
Another question is app-tools 、module-tools and doc-tools shared common initial schema in packages/cli/core/src/schema/patchSchema.ts , I think it is not good, because some config params can not be shared.
This isssue can be divided into two parts for resolution:
- Ensure that the params are defined within the plugin and implement validation logic within the plugin itself.
- Define validation logic for the resolution level separately.
Is there a better way? welcome discussion~
https://github.com/web-infra-dev/modern.js/pull/4378
Reproduce link
no
Reproduce Steps
no
Ajv provide a config called additionalProperties to validate additional properties like runtime, but we cannot use it in app-tools because some additional properties are provided by Modern.js Builder, we cannot disallow all additional properties...
We have removed all Ajv.