9.0.2 • Published 6 months ago

@knime/eslint-config v9.0.2

Weekly downloads
-
License
GPL 3 and Additio...
Repository
github
Last release
6 months ago

Image @knime/eslint-config

This repository contains an ESLint ruleset for typical KNIME frontend projects. Rules cover simple JavaScript/TypeScript setups as well as Vue/Nuxt projects and common test scenarios with Vitest.

Also it contains configs for Stylelint, lintstaged and a Git hook to format commit messages.

Code formatting is supposed to be handled via Prettier.

Development

Prerequisites

Newer versions may also work, but have not been tested.

Installation

To install the @knime/eslint-config package, you can use npm:

npm install @knime/eslint-config -D

Linting

The different ESLint profiles contained herein can also be linted by running

npm run lint

Using the ESLint profiles in your project

Projects need to specify the following devDependencies in their package.json files, but none of the required additional plugins:

The following code block should give an understanding of a commonly used setup in your eslint.config.js file:

import knimeVue3Config from "@knime/eslint-config/vue3.js"

export default = [
  ...knimeVue3Config,
  {
    globals: {
      consola: true,
    }
  },
  // [...]
];

Using Stylelint in your project

The following code block should give an understanding of a commonly used setup in your .stylelintrc file:

module.exports = {
  extends: ["@knime/eslint-config/stylelint/vue"],
};

See stylelint folder for available configs.

Using Git hooks in your project

The package supplies the tools to running a couple of commit hooks:

Linting and formatting staged changes

Include the following in a pre-commit hook to lint and format the changes in your stage zone (via lintstaged).

#!/usr/bin/env bash
pnpm dlx lint-staged

Additionaly, use the lint-staged.config.mjs file to configure lint-staged, i.e. create a lint-staged.config.mjs file in the root folder containing

import config from "@knime/eslint-config/lint-staged.config.mjs";
export default config;

Format commit message

Use a prepare-commit-msg hook to format your commit message to conform with the required format by KNIME:

#!/usr/bin/env bash
npm exec knime-eslint-config-prepare-commit-msg "$@"

In case the npm project isn't in the root folder, please do:

#!/usr/bin/env bash
<path-to-npm-project>/node_modules/.bin/knime-eslint-config-prepare-commit-msg "$@"

Refer to scripts/README.md for more information.

8.3.0

9 months ago

9.0.2

6 months ago

9.0.1

7 months ago

9.0.0

7 months ago

8.2.0

1 year ago

8.1.1

1 year ago

8.1.0

1 year ago

8.0.14

2 years ago

8.0.13

2 years ago

8.0.12

2 years ago

8.0.11

2 years ago

8.0.10

2 years ago

8.0.9

2 years ago

8.0.8

2 years ago

8.0.5

2 years ago

8.0.4

2 years ago

8.0.7

2 years ago

8.0.6

2 years ago

7.2.1

2 years ago

7.2.0

2 years ago

8.0.1

2 years ago

8.0.0

2 years ago

8.0.3

2 years ago

8.0.2

2 years ago

7.1.6

3 years ago

7.1.5

3 years ago

7.1.4

3 years ago

7.1.3

3 years ago

7.1.2

3 years ago

7.1.1

3 years ago

7.1.0

3 years ago

7.0.6

3 years ago

7.0.5

3 years ago

7.0.4

3 years ago

7.0.3

3 years ago

7.0.1

3 years ago

7.0.0

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago