mt-lint

raw JSON →
0.0.21 verified Fri May 01 auth: no javascript

A static code analysis tool for iOS, Android, and JavaScript projects, designed to be integrated into development workflows. Current stable version is 0.0.21, released with a focus on Xcode 9 compatibility and Git pre-commit hooks. It supports custom rules and analysis for iOS (including CocoaPods projects) and JS, with basic Android support. Unlike general-purpose linters, mt-lint is specifically tailored for mobile app development, automating code checks on commit to enforce coding standards.

error mt-lint: command not found
cause mt-lint is not installed globally or not in PATH
fix
Run npm install -g mt-lint to install globally.
error Error: Platform not set. Please use mt-lint add -P <platform> first.
cause You must set the platform before running start or other commands.
fix
Execute mt-lint add -P ios (or android/js) before running other commands.
error Git hook installation failed: .git directory not found.
cause The path provided with -H does not point to a directory containing .git.
fix
Ensure you provide the correct path to the .git directory or the project root that contains it.
gotcha iOS projects using Xcode 9 must set COMPILER_INDEX_STORE_ENABLE to NO to avoid compilation issues.
fix Set COMPILER_INDEX_STORE_ENABLE = NO in Xcode build settings or add the provided CocoaPods post_install hook.
gotcha For iOS projects, the .git directory must be in the same parent directory as the .xcodeproj/.xcworkspace file for automatic pre-commit hook to work.
fix Use mt-lint add -H <git-path> -S <proj-path> to specify both paths explicitly.
breaking If the pre-commit hook is active and a commit fails analysis, the commit is blocked. To skip the hook, use git commit --no-verify or -n.
fix Add --no-verify flag to git commit command for emergency commits.
deprecated The -P option for setting platform may be deprecated in future versions in favor of automatic detection.
fix Keep using -P for now; future versions may add auto-detection.
npm install mt-lint
yarn add mt-lint
pnpm add mt-lint

Installs mt-lint globally, sets the platform to iOS, and starts static analysis on a project.

npm install -g mt-lint
mt-lint add -P ios
mt-lint start my_project_path