Skip to content

Commit

Permalink
Release v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nlydv committed Jul 20, 2022
1 parent be75e57 commit be917f4
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 70 deletions.
48 changes: 33 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
# Nova Stylelint Changelog
I'll try to keep up with documenting changes here in this file.

## 1.1.0
## v2.0.0
`July 19, 2022`

### Added
- Options to individually enable/disable linting of file types other than plain CSS
- Local workspace configuration options mirroring global preferences
- Workspace-specific option to disable extension in current project

### Fixed
- Inability to discover and prefer locally installed Stylelint package, in some cases
- Inconsistent module resolution and error reporting in deeply nested projects [#2](https://github.com/nlydv/nova-stylelint/issues/2)
- Built-in stylelint executable not usable as final fallback
- Path type user configs no longer working with `~/` prefixed inputs

### Changed
- Upgrade inline issue "squigglies" to extend under applicable text range rather than only at discrete points
- More robust module resolution, error handling, and information feedback
- Improvements in performance/speed

## v1.1.0
`April 14, 2022`

### Added
Expand All @@ -12,15 +31,18 @@ I'll try to keep up with documenting changes here in this file.
- Sporadic/jittery behavior on activation & initial install

### Changed
- `fallback.behavior` options from `[none|ignore]` to `[loud|quiet|silent]`
- Config not found behavior options from `[none|ignore]` to `[loud|quiet|silent]`
- More contextualized & actionable `stylelintrc` error information
- Much better UX in general when passing errors/alerts to user
- Updated extension icon

## 1.0.4
Bump to fix in-app icon display
## v1.0.4
`March 30, 2022`

### Changed
- Bump version only to push fix for in-app icon display

## 1.0.3
## v1.0.3
`March 30, 2022`

### Fixed
Expand All @@ -30,31 +52,27 @@ Bump to fix in-app icon display
### Changed
- Updated README & added preview image
- Nicer extension icon image
- Refactoring

## 1.0.2
## v1.0.2
`March 28, 2022`

### Fixed
- Hotfix
- Hotfix to patch self-thrown error not being caught as intended

## 1.0.1
## v1.0.1
`March 28, 2022`

### Fixed
- Bug that regards `.stylelintrc*` files as non-existent if it's unable to resolve plugins/extends rules therein [#1](https://github.com/nlydv/nova-stylelint/issues/1)
- Bug where `.stylelintrc*` files are seen as non-existent when unable to resolve external modules defined therein [#1](https://github.com/nlydv/nova-stylelint/issues/1)

### Changes
### Changed
- Minor optimizations around fallbacks and internal discovery

## 1.0.0
## v1.0.0
`March 23, 2022`

### Added
- Everything

### Fixed
- Nothing

### Changes
- Created
125 changes: 74 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,116 @@
# Nova Stylelint

[Stylelint](https://stylelint.io) extension for [Nova](https://nova.app), a new macOS-native code editor from [Panic](https://panic.com).
[Stylelint](https://stylelint.io) extension for [Nova](https://nova.app), a new macOS-native code editor from [Panic](https://panic.com), that presents real-time stylesheet linting results with inline and sidebar warnings by plugging into Nova's built-in issue provider system.

![](https://raw.githubusercontent.com/nlydv/nova-stylelint/master/preview.png)

## Overview
## Features

This extension presents real-time stylesheet linting results with inline and sidebar warnings by plugging into Nova's built-in issue provider system. It works [out-of-the-box](#batteries-included) for CSS, SCSS, and SASS files without requiring external plugins, rulesets, or custom syntaxes.
- Inline and sidebar linting results
- Validates files on change
- Command & menu item to autofix all issues (shortcut **⌥F** by default)
- Enable/disable linting of individual syntax types
- Ability to set preferences per-project as well as globally
- Option to configure a global fallback `stylelintrc` config to use when none is found, or use the bundled standard config instead
- Option to set a `--config-basedir` for Stylelint to use in resolving dependencies
- Able to lint CSS and Sass/SCSS files [out-of-the-box](#batteries-included) in absence of common user-installed plugins, rulesets, or custom syntax modules

### Requirements
## Setup

If you already have Stylelint installed on your system, you're good to go! Otherwise, as long as you have an installation of Node.js and npm on your Mac that is accessible via your `$PATH` variable, you shouldn't need to install anything else.
The only requirement to being able to use this extension is having Node.js installed on your system.

However, if you don't have Node.js installed, the quickest way to get up and running is to install Stylelint through [Homebrew](https://brew.sh):
If you don't already have Node.js installed, the quickest way to get up and running is to install Stylelint through [Homebrew](https://brew.sh):
```
brew install stylelint
brew install node
```

This will also install Node.js as a dependency of Stylelint if you don't already have it.
For more granular control over managing Node.js installation(s), also checkout [*nvm*](https://github.com/nvm-sh/nvm). Note however, that if you have Node.js installed via *nvm* while simultaneously having a copy of Node installed via Homebrew, you're likely to run into problems sooner or later.

### Install
> *I'm assuming you are at least somewhat familiar with Stylelint and using Node packages. If not, or if you're running into issues with this extension, see the [Environment Setup](#environment-setup) section near the bottom of this README for more details.*
Depending on which digital wormhole you traveled through to find this document, you may have already passed the `Install` button on your way down here.
## Install

Otherwise, open Nova and from the menu bar `Extensions > Extension Library` then search for _Stylelint_.
Depending on which digital wormhole you traveled through to find this document, you may have already passed the `Install` button on your way down here.

Or you could harness the awesome power that is ***21st century technology*** and save like 5 extra seconds by right-clicking the URI below and selecting `Services > Open URL`
```
nova://extension/?id=com.neelyadav.stylelint&name=Stylelint
```
Otherwise, open Nova and from the menu bar `Extensions > Extension Library` then search for *Stylelint*... or if you want to save, like, 5 extra seconds, you can click [this link](https://panic.com/open-in-nova/extension/?id=com.neelyadav.stylelint) on your Mac to automatically open the extension page within Nova (assuming you have Nova installed).

## Usage

Currently, the extension will activate and lint CSS, SCSS, Sass, and Less files only. You can individually enable/disable linting of each of those languages in the extension preferences.

Any global extension preferences available can also be set on a per-workspace basis. When configuring workspace-specific preferences for this extension, you can additionally disable linting all together (i.e. disables the extension in that project only).

### Configuration

You'll also want to have a `stylelintrc` configuration file within a project directory (or any of its parent directories, see the [Stylelint docs](https://stylelint.io) for more info).
You'll want to have a `stylelintrc` configuration file within a project directory (or any of its parent directories, see the [Stylelint docs](https://stylelint.io) for more info).

When editing stylesheet files without an accessible `stylelintrc`, you can set the desired behavior in the extension preferences. By default an error alert is presented in that situation, but if you like you can change this to be less obstructive, silenced, or automatically fallback to linting with an alternative config file.

Discovery of stylelintrc config files for a given stylesheet—as well as resolution of any plugins/extends set within—should otherwise function just the same as if you were running stylelint yourself from the command line.
Discovery of stylelintrc config files for a given stylesheet—as well as finding any external plugin packages your config requires—should otherwise function just the same as if you were running stylelint yourself from the command line.

### Plugins

If your stylelintrc config requires external packages (e.g. [stylelint-order](https://github.com/hudochenkov/stylelint-order) or [stylelint-config-primer](https://github.com/primer/stylelint-config)) via the `plugins`, `extends`, `customSyntax`, or other properties, then you'll need to make sure that those packages are accessible to Stylelint somehow.
If your stylelintrc config requires external packages (e.g. [stylelint-order](https://github.com/hudochenkov/stylelint-order) or [stylelint-config-primer](https://github.com/primer/stylelint-config)) via the `plugins`, `extends`, `customSyntax`, or other properties, then you'll need to make sure that those packages are accessible to Stylelint somehow. Ideally by installing those packages along with Stylelint itself in your local project.

#### Batteries Included

This extension comes pre-installed with some common plugins and rulesets:
* `stylelint-config-recommended`
* `stylelint-config-standard`
* `stylelint-config-recommended-scss`
* `stylelint-config-standard-scss`
* `stylelint-scss`
* `postcss-scss`
* any other plugins that are dependencies of the above
This extension comes pre-installed with some common plugins, rulesets, and syntax modules:
- `stylelint-config-recommended`
- `stylelint-config-standard`
- `stylelint-config-recommended-scss`
- `stylelint-config-standard-scss`
- `stylelint-scss`
- `postcss-scss`
- `postcss-sass`
- and any other plugins that are dependencies of the above

If your config's required plugins are not all normally discoverable by Stylelint, the extension will automatically try pointing to this pre-installed set to see if it includes what is missing and proceed with linting if so.
This is to make it easier to lint and use a global/personal config file outside of a dedicated project environment. For example, if you wanted to quickly lint a standalone stylesheet file outside of any project workspace using Stylelint from the command line, you'd have to set flags for `--config` and `--config-basedir` to make it work.

For other plugins the easiest way to install them is globally via npm. This way Stylelint can always find your external plugins/configs from anywhere:
```
npm install -g <PACKAGE>
```
Setting the extension to use a static config path as a fallback would resolve the first part, and then the extension will automatically try to handle the second part: when your fallback config's required plugins are not all normally discoverable by Stylelint, the extension will try pointing to this bundled set of packages to see if it includes what is missing and then proceed with linting if so.

If you have a separate directory of installed linter plugins for whatever reason, you can configure the extension to *always* pass that path to Stylelint's `--config-basedir` flag in the extension or workspace preferences.

If you have stylelint packages installed at the project-level (e.g. as a `devDependency`), then as long your relevant `.stylelintrc` config is within the same project, you should be fine.
Whenever the above processes are unable to find any packages required by your config, an error alert will popup with additional information.

Lastly, if you're like me and have a separate directory to install linter plugins so not to clutter up your global npm store, or for whatever other reason, you can configure that path in the extension preferences to pass it on to Stylelint's `--config-basedir` flag.
#### Environment Setup

For the best results, it's recommended that you install any external packages your config requires, along with Stylelint itself, locally via npm in the project(s) you're working on, even if already installed globally:
```sh
cd your-project
npm i -D stylelint # and all other packages your config requires
```

An error alert will popup whenever the above processes could not find any packages required by your config.
The reason installing locally is recommend is due to some constraints Stylelint has when using custom syntax modules (plugins that enable you to lint files other than plain CSS such as SCSS, Less, HTML, etc). Specifically, the installed Stylelint package being used needs to be in the same location as any custom syntax modules it tries to use. Even if you don't explicitly install or configure custom syntax modules, you're almost certainly using them whenever linting non-CSS files.

## Other
Additionally, while you could technically install any Stylelint-related packages exclusively in your global npm store, that would make it difficult to share and collaborate on a project... and harder to manage dependencies across multiple projects. Inevitably, you'll have to start moving some packages locally and once you split dependencies between global and local, problems are likely to arise.

## Development

### Ideas
> In no particular order

- [X]  Add `fix` command
- [ ]  Figure out why stylelint caching is weird
- [ ]  Out-of-the-box support for inline CSS in HTML, JS files
- [ ]  Option to toggle between linting `onSave` and `onChange`
- [ ]  Configurable delay before execution (on top of built-in)
- [ ]  Autofix on save option
- [ ]  Task template for build pipelines `??`
- [ ]  Single issue fix command `?`
- [ ]  Enable workspace-specific preferences
- [ ]  Auto-substitute indent spacing rule with values set within Nova itself
- [ ]  Options to skip linting of certain files (e.g. `vendor`, `node_modules`, etc.)
<sup>*In no particular order*</sup>

**** Add `fix` command

**** Figure out why stylelint caching is weird and implement

**** Out-of-the-box support for CSS embedded in HTML, PHP, JS, etc. syntaxes

**** Option to toggle between linting `onSave` and `onChange`

**** Configurable delay before execution (on top of built-in)

**** Autofix on save option

**** Task template for build pipelines `??`

**** Single issue fix command `?`

**** Enable workspace-specific preferences

### Note
**** Auto-substitute indent spacing rule with values set within Nova itself

Quick confession, I'm still on my 30-day free trial of Nova and haven't actually decided whether or not I'm going to switch to it as a primary editor. Creating a plugin to fill a gap in the tools I'm used to having is definitely a good way to get a proper feel for an editor though!
~~**** Options to skip linting of certain files (e.g. `vendor`, `node_modules`, etc.)~~

### Contribute

Expand All @@ -100,6 +123,6 @@ Feel free to also reach out to me on Twitter:
## License

Copyright © 2022 [Neel Yadav](https://neelyadav.com)
<br>MIT License

This project is licensed under the terms of the MIT License.
<br>Full license text is available in the [LICENSE.md](https://github.com/nlydv/nova-stylelint/blob/master/LICENSE.md) file.
Full license text is available in the [LICENSE.md](https://github.com/nlydv/nova-stylelint/blob/master/LICENSE.md) file.
2 changes: 1 addition & 1 deletion Stylelint.novaextension/extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Stylelint",
"organization": "Neel Yadav",
"identifier": "com.neelyadav.stylelint",
"version": "1.1.0",
"version": "2.0.0",
"description": "Stylelint extension for Nova's built-in issue provider system.",
"license": "MIT",
"categories": [
Expand Down
4 changes: 2 additions & 2 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nova-stylelint",
"author": "Neel Yadav <mail@neelyadav.com>",
"version": "1.1.0",
"version": "2.0.0",
"description": "Stylelint extension for Nova, a new macOS-native code editor from Panic.",
"private": true,
"license": "MIT",
Expand Down
Binary file modified preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit be917f4

Please sign in to comment.