-
Notifications
You must be signed in to change notification settings - Fork 0
eng-557 build centralized linting system for all repos #10
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
Merged
CDeltakai
merged 56 commits into
staging
from
feature-eng-557-centralized-linting-system-for-all-repos
Apr 15, 2025
Merged
Changes from 43 commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
f6418cb
feat: initial commit
CDeltakai 6b934a1
fix: deleted old index.js file
CDeltakai c8ecb57
fix: update @typescript-eslint dependencies to latest version
CDeltakai 626a974
feat: update ESLint plugin structure and integrate with recommended c…
CDeltakai a482d69
feat: updated all packages in repo including linter and created a fla…
CDeltakai cbe4f51
fix: ran lint f
CDeltakai bd41999
fix: removed bench and test from package as they are unneeded
CDeltakai 16c7e50
fix: changed the config bundle to be js instead of ts, removed the ex…
CDeltakai d25a039
fix: fixed import ordering
CDeltakai ed540cf
wip: replacing config bundle with config from zeta.house, removing pa…
CDeltakai ec8c017
fix: did a lintfix and removed unnecessary comments
CDeltakai d98df43
fix: did a lintfix
CDeltakai f385fa4
fix: fixed up formatting for eslint config
CDeltakai b39e15e
feat: adding generic test files and necessary packages
CDeltakai 5fd8914
wip: fixing up ESM
tegefaulkes ae54301
fix: fixed issue with jest test not working correctly
CDeltakai 99a7bc6
refactor: removed the recommendedTypeaware ruleset and instead merged…
CDeltakai 3073893
fix: removed unused import
CDeltakai bd7cb3b
fix: deleted old .eslintrc file since it was no longer needed
CDeltakai 3d2e8d1
feat: implementing lint script and an external eslint runner that can…
CDeltakai 0cd35e5
wip: testing changes to fix issue with lint.ts not running correctly
CDeltakai 97234e9
wip: managed to get command mostly working, ironing out the kinks
CDeltakai 552430b
wip: adjusting parameters to test for tsconfig related issues
CDeltakai a0892c0
wip: commenting out the shellcheck and prettier commands for now sinc…
CDeltakai 9a2570c
wip: made runESlint detect tsconfig files inside the target repo and …
CDeltakai a3b75e3
feat: implemented working shellcheck linting and prettier linting
CDeltakai b86bd67
fix: removed unnecessary comment
CDeltakai 44fd174
fix: removed await from runESLint as that was preventing the other li…
CDeltakai e0f502c
fix: did lintfix and removed unnecessary elements
CDeltakai 6e36135
feat: added user-config and config flags to allow users to adjust whi…
CDeltakai bc7b831
fix: did a lintfix
CDeltakai 1e72c7d
feat: update README.md
CDeltakai a7a70f7
fix: removed exporting index.ts since it wasnt needed anymore. also r…
CDeltakai 26ccb3b
fix: reintroduced eslint as a peer depedency for convenience if users…
CDeltakai 50ee4e7
refactor: moved util functions into its own folder and file
CDeltakai 6d9b61d
feat: add comments to util functions
CDeltakai 651a900
wip: designing solution to dealing with multiple .tsconfigs and edge …
CDeltakai 9391406
feat: update readme
CDeltakai f27da91
fix: removed unnecessary comments and unnecessary method
CDeltakai b79d983
refactor: removed recommended config since it was no longer needed
CDeltakai e8b67b0
renamed primary config to js.ts, lintfixed
CDeltakai 3e48f84
refactor: moves buildpatterns and resolveMatrixConfig into a single u…
CDeltakai d89a1e7
fix: update readme to match jslogger style
CDeltakai 42948eb
feat: changed package.json to just run the lint script on the repo it…
CDeltakai 5760f21
feat: ran npm docs
CDeltakai 2853f15
fix: various review fixes and clean up - removed unnecessary elements
CDeltakai 80bf13b
fix: changed collectMarkdown to just use the recursive option, made h…
CDeltakai 16c788b
fix: added type guard for raw matrix cfg when resolving matrix config,
CDeltakai f8d9631
fix: update imports to use node module syntax for consistency
CDeltakai f914431
feat: turned MatrixAILintConfig and RawMatrixCfg into their own types…
CDeltakai 7ec3b3d
feat: fixed up some comments and added some more documentation
CDeltakai e8891d1
feat: ran docs
CDeltakai bcca02a
refactor: moved runESLint into utils.ts and removed runners and its c…
CDeltakai 94ab584
refactor: moved utils and types into src instead of their own folder.…
CDeltakai c62d59a
fix: update condition for excluding patterns in buildPatterns function
CDeltakai 1257b31
fix: changed package.json to build before running lint or lintfix in …
CDeltakai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,124 @@ | ||
# js-eslint | ||
# @matrixai/lint | ||
|
||
A batteries-included, TypeScript-aware linting CLI and ESLint flat config bundle for use in Matrix AI JavaScript/TypeScript projects. | ||
|
||
- Type-aware linting powered by `@typescript-eslint` using one or more `tsconfig.json` files | ||
- Built-in support for React, Tailwind, JSX a11y, Prettier, and Matrix AI custom rules | ||
- Supports Prettier formatting for Markdown and ShellCheck for shell scripts | ||
- Single command to lint JavaScript/TypeScript, Markdown, and shell scripts | ||
- Customizable via `matrixai-lint-config.json` and extensible with your own ESLint config | ||
- CLI options to override config and enable auto-fix | ||
|
||
## Installation (not yet published) | ||
|
||
```sh | ||
npm install --save-dev @matrixai/lint | ||
``` | ||
|
||
## Usage | ||
|
||
```sh | ||
matrixai-lint | ||
``` | ||
|
||
To run with autofix: | ||
|
||
```sh | ||
matrixai-lint --fix | ||
``` | ||
|
||
### CLI Options | ||
|
||
| Flag | Description | | | | ||
| ----------------- | ------------------------------------------- | - | ------------------------------------- | | ||
| *(no flag)* | Uses built-in Matrix AI ESLint config | | | | ||
| `--fix` | Enables auto-fixing via ESLint and Prettier | | | | ||
| `--user-config` | Uses detected \`eslint.config.[c | m | t]js\` from the project root if found | | ||
| `--config <path>` | Explicitly use a custom ESLint config file | | | | ||
|
||
### Examples | ||
|
||
```sh | ||
matrixai-lint --fix | ||
matrixai-lint --user-config | ||
matrixai-lint --config ./eslint.config.js --fix | ||
``` | ||
|
||
## TypeScript Support | ||
|
||
The linter is TypeScript-aware and \*\*requires a \*\***`tsconfig.json`** to determine which files to lint and how to parse them. | ||
|
||
By default: | ||
|
||
- It looks for `tsconfig.json` in the project root | ||
- Files are selected based on the `include` and `exclude` fields in the tsconfig | ||
|
||
### Working with multiple tsconfigs | ||
|
||
If your project uses more than one `tsconfig.json` or doesn't have one at the root, you can configure the linter using a `matrixai-lint-config.json` file at the root: | ||
|
||
```json | ||
{ | ||
"tsconfigPaths": [ | ||
"./tsconfig.base.json", | ||
"./packages/core/tsconfig.json" | ||
], | ||
"forceInclude": [ | ||
"scripts", | ||
"src/overrides" | ||
] | ||
} | ||
``` | ||
|
||
| Field | Type | Description | | ||
| --------------- | ---------- | ---------------------------------------------------------------------------------------- | | ||
| `tsconfigPaths` | `string[]` | One or more paths to `tsconfig.json` files | | ||
| `forceInclude` | `string[]` | Paths to always include, even if excluded by tsconfig (must be included by at least one) | | ||
|
||
> ⚠ If a path in `forceInclude` is not included in any of the `tsconfigPaths`, TypeScript will throw a parsing error. | ||
|
||
## ESLint Config Override | ||
|
||
You can use your own ESLint config by one of the following methods: | ||
|
||
### 1. Inline Custom Config | ||
|
||
```sh | ||
matrixai-lint --config ./eslint.config.js | ||
``` | ||
|
||
### 2. Auto-detect with `--user-config` | ||
|
||
```sh | ||
matrixai-lint --user-config | ||
``` | ||
This will look for a valid eslint.config file in the project root. | ||
|
||
Valid config filenames: | ||
|
||
- `eslint.config.js` | ||
- `eslint.config.cjs` | ||
- `eslint.config.mjs` | ||
- `eslint.config.ts` | ||
|
||
### 3. Extend the base config | ||
|
||
```ts | ||
// eslint.config.js | ||
import matrixai from '@matrixai/lint/config'; | ||
|
||
export default [ | ||
...matrixai, | ||
{ | ||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'error', | ||
'no-console': 'off' | ||
} | ||
} | ||
]; | ||
``` | ||
|
||
## License | ||
|
||
Apache 2.0 © Matrix AI. Maintained by [Roger Qiu](https://github.com/MatrixAI) | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.