npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@netatwork/aurelia-lint

v1.10.0

Published

This is a linter for aurelia template files to detect common mistakes.

Downloads

2

Readme

Aurelia Lint

This is a linter for aurelia template files to detect common mistakes.

Configuration

// aurelia-lint.json5
{
	// Array of file paths to extend from:
	extends: [
		"node_modules/some-packages/aurelia-lint.json5",
	],

	// The root directory of sources in this project:
	// (This is used to correctly resolve view resources)
	srcRoot: "./src",

	// Array of glob patterns for files to lint:
	// (See https://www.npmjs.com/package/picomatch)
	include: [
		"./src/**/*.html",
	],

	// An object with rules and configuration options:
	rules: {
		"rule-1": "error",
		"rule-2": "warn",
		"rule-3": "info",
		"rule-4": ["error", { ...options }],
		"rule-5": { ...options },
	},
}

Usage

npx naw-aurelia-lint ...
  • --config <filename> - Specify a config filename. Default is ./aurelia-lint.json5
  • --watch - Lint and watch for changes.
  • --no-color - Disable colored output.

Disabling Rules

Rules can be temporarily disabled via html comments:

Disable for the next line:

<!-- aurelia-lint-disable-line example-rule -->

Disable for a range of lines:

<!-- aurelia-lint-disable example-rule -->
...
<!-- aurelia-lint-enable example-rule -->

Or for the entire file:

<!-- aurelia-lint-disable example-rule -->
...
...

Optionally, disable comments can have multiple lines and multiple disable instructions or explanations:

<!--
	aurelia-lint-disable example-rule
	aurelia-lint-disable second-rule
	Example rule is disabled because...
-->

Builtin Rules

attribute-usage

Require or disallow attributes on specific elements. This rule automatically ignores suffixes like .bind.

rules: {
	"attribute-usage": {
		elements: {
			"example-element": {
				// Disallow the use of specific attributes:
				disallow: ["id", "title"],

				// Require specific attributes to be present:
				require: ["value"],
			},

			// Slashes can be used to target specifically nested elements:
			"list/list-column": { ... },
		}
	}
}

editorconfig-format

Ensure that all template files are correctly formatted according to the respective .editorconfig file. This rule validates indentation, line endings and trailing whitespace.

element-nesting

Allow or disallow specific element children.

rules: {
	"element-nesting": {
		elements: {
			"text-block": {
				categories: ["block"],

				// Either allow only specific elements:
				allow: [
					// Allows <example-element>:
					"example-element",

					// Allows all elements that have the "inline" category:
					"@inline"
				],
				// or disallow specific elements:
				disallow: [...]

				// Disallow text content:
				// - Text content is allowed by default.
				// - Whitespace is always ignored.
				allowText: false,
			},

			"span": {
				categories: ["inline"],
			},
			"b": {
				categories: ["inline"],
			},

			// Slashes can be used to target specifically nested elements:
			"list/list-column": { ... }
		}
	},
}

html-custom-element-compat

Enforce compatibility with the html custom element spec by enforcing valid custom element names. This prevents accidentally using semantic elements as custom element names like <button> or <details>.

rules: {
	"html-custom-element-compat": {
		// An array of elements to ignore:
		// (Builtin aurelia elements are ignored automatically)
		ignore: [
			"something",
		]
	}
}

no-dead-templates

Require <template> elements to have at least one of the following attributes: "id", "if", "else", "repeat", "replace-part"

no-duplicate-requires

Ensure that there are no duplicate <require from="..."> elements.

no-invalid-bindings

Ensure that there are no bindings with syntax that can not be parsed by aurelia.

require-view-resources

Ensure that all elements, binding behaviors and value converters are either global or have an associated <require from="..."> element.

rules: {
	"require-view-resources": {
		// An array of elements to ignore:
		// (Builtin aurelia elements are ignored automatically)
		ignoreElements: [
			"global-element",
			"div",
			"span",
			"button",

			// Slashes can be used to target specifically nested elements:
			"list/list-column",
			"list/list-column/header",

			...
		],

		// An array of value converters to ignore:
		ignoreValueConverters: [
			"globalValueConverter",
			...
		],

		// An array of binding behaviors to ignore:
		// (Builtin aurelia binding behaviors are ignored automatically)
		ignoreBindingBehaviors: [
			"globalBindingBehavior",
			...
		],
	},
},