Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
eslint[JSON]: Migrate to flat configuration model
Openbmc repo CI uses `eslint-plugin-json` package[1] for JSON linting, and it appears that its broken for eslint@latest versions that mandated the use of flat config. There is some on-going work on fixing the plugin to add flat configuration support[2], but its still a work in progress. This commits also removed `eslint-plugin-json` package and leverages `eslint-plugin-jsonc` package[3], which is better maintained & also uses the same AST as Javascript for linting.Since the plugin could provide AST & source code text back to the eslint engine, we can now use eslint directives such as `/*eslint-disable <checks>*/` in json files. Also it does seem like there are plans to merge[4] `eslint-plugin-json` into `eslint-plugin-jsonc`. Flat configuration model deprecates the use of `.eslintrc.json` and also `.eslintignore`. Instead eslint now relies on just one java script based configuration file `eslint.config.mjs` for everything. So we had to now add some logic into the configuration file to append the repo specific ignores to the global ignores, which forced us to bring yet another node js package `fs`. Since latest versions of eslint flags a warning if there is a presence of deprecated `.eslintignore` file in repositories,I renamed it from `.eslintignore` to `.eslintIgnore`. [1]: https://www.npmjs.com/package/eslint-plugin-json [2]: azeemba/eslint-plugin-json#82 [3]: https://www.npmjs.com/package/eslint-plugin-jsonc [4]: azeemba/eslint-plugin-json#85 Change-Id: I0fa8c928a7449e08d761022dde1f1da3ee48cf62 Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
- Loading branch information