Skip to content

ericsorenson/nova-eslint

Repository files navigation

Nova ESLint Starlight Edition

CI

ESLint integration for the Nova code editor.

Extension

The extension source code is in the eslint.novaextension/ directory. See the extension README for user documentation.

Development

Running Tests

The project includes a comprehensive test suite covering bug fixes, error handling, and core functionality:

npm test                 # Run all tests
npm run test:coverage    # Run tests with coverage report

Linting

The project uses ESLint with Prettier and Perfectionist for code quality:

npm run lint             # Check code style
npm run lint:fix         # Auto-fix linting issues

Dependency Management

The project uses Renovate for automated dependency updates:

  • Automatic updates: Minor and patch updates are auto-merged after CI passes
  • Security alerts: Security vulnerabilities are auto-merged immediately
  • Grouped updates: ESLint and Prettier packages are grouped together
  • Schedule: Updates run weekly on Mondays before 6am PT

Option 1: GitHub App (Recommended)

  1. Install the Renovate GitHub App on your repository
  2. Renovate will automatically detect the renovate.json configuration
  3. Pull requests for dependency updates will be created automatically

Option 2: CLI (Local Testing)

You can run Renovate locally to test configuration changes:

npm run renovate:config   # Validate renovate.json configuration
npm run renovate          # Run Renovate locally (requires GITHUB_TOKEN)

To run Renovate CLI with GitHub:

export GITHUB_TOKEN=your_github_token
npm run renovate

Manual Updates (Alternative)

The project also includes npm-check-updates for manual dependency updates:

npm run update            # Check for updates and update package.json
npm install               # Install updated dependencies

Test Coverage:

The test suite includes both integration tests (with Nova mocks) and domain tests (framework-independent):

Integration Tests:

  • ESLintProvider: Issue conversion, debouncing, error notifications, disposal
  • ESLintRunner: Adapter functionality and backward compatibility
  • ESLintUtils: Pure utility functions for parsing and conversion
  • Main: Fix-on-save tracking and configuration management

Domain Tests (No Nova Dependencies):

  • LintService: Core linting logic, ESLint execution, caching, error handling
  • Domain Models: LintConfig, LintRequest, LintResult, FixResult

Test coverage includes:

  • Bug fixes (memory leaks, disposal, caching)
  • Error handling and notification logic
  • Exit code handling and timeout scenarios
  • Process execution and stdin/stdout communication
  • Fix-on-save cycle prevention

Tests are located in the test/ directory and use Node.js's native test runner (no external libraries required).

Testing the Extension

  1. Open this project in Nova
  2. Enable Extension Development in Nova Preferences → General
  3. Select Extensions → Activate Project as Extension
  4. The extension will be active in the current Nova window

Project Structure

eslint.novaextension/
├── extension.json          # Extension manifest
├── Scripts/
│   ├── main.js            # Entry point
│   ├── eslint-provider.js # Issue provider
│   └── eslint-runner.js   # ESLint process runner
├── README.md              # User documentation
└── CHANGELOG.md           # Version history

Key Architecture

  • main.js: Activates the extension, registers the issue assistant, watches config changes
  • eslint-provider.js: Implements the Nova issue assistant interface, manages issues
  • eslint-runner.js: Finds and executes ESLint, handles process communication

How It Works

  1. Extension activates when JavaScript/TypeScript files are opened
  2. ESLintProvider implements Nova's issue assistant interface
  3. On save (or change), provideIssues() is called
  4. ESLintRunner finds ESLint in node_modules and executes it
  5. File content is sent via stdin with --stdin-filename
  6. ESLint returns JSON results
  7. Results are converted to Nova Issue objects
  8. Issues appear inline in the editor

Development Resources

License

MIT

About

ESLint Extension for Nova

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors