@walgreenshealth/test-eslint-plugin
v0.0.7
Published
This plugin is mostly a set of configurations for ESLint. It consolidates a bunch of open source plugins and has _a lot_ of rules.
Downloads
1
Readme
@walgreenshealth/eslint-plugin
This plugin is mostly a set of configurations for ESLint. It consolidates a bunch of open source plugins and has a lot of rules.
It includes the following configs:
walgreenshealth/recommended
@walgreenshealth/typescript
@walgreenshealth/storybook
@walgreenshealth/jest
And the following custom rules:
@walgreenshealth/custom-element-name
makes sure name of a custom element declared in@customElement(walgreenshealth-whatever)
matches its file name@walgreenshealth/element-export-name
makes sure the element's class name matches the file name
Here's a simple example of how to use it (.eslint.config.json
):
{
"plugins": ["@walgreenshealth/eslint-plugin"],
"extends": ["plugin:@walgreenshealth/recommended"],
"overrides": [
{
files: ["*.stories.js"],
extends: [
"plugin:@walgreenshealth/recommended",
"plugin:@walgreenshealth/storybook",
],
},
{
files: ["*.test.js"],
extends: [
"plugin:@walgreenshealth/recommended",
"plugin:@walgreenshealth/storybook",
],
}
};
/* eslint sonarjs/no-duplicate-string: "off" */
"use strict";
const typescriptParserOptions = {
project: "tsconfig.eslint.json",
tsconfigRootDir: __dirname,
};
module.exports = {
parserOptions: {
ecmaVersion: 2022,
sourceType: "module",
},
extends: ["plugin:@walgreenshealth/recommended"],
ignorePatterns: [
"**/node_modules/**",
"**/*.min.js",
"**/dist/**",
"**/coverage/**",
"**/reports/**",
"**/.stryker-tmp/**",
"**/_templates/**",
"stryker.conf.json",
],
overrides: [
{
files: ["*.ts"],
extends: [
"plugin:@walgreenshealth/recommended",
"plugin:@walgreenshealth/typescript",
],
parserOptions: typescriptParserOptions,
},
{
files: ["**/*.stories.ts"],
extends: [
"plugin:@walgreenshealth/recommended",
"plugin:@walgreenshealth/typescript",
"plugin:@walgreenshealth/storybook",
],
parserOptions: typescriptParserOptions,
},
{
files: ["**/*.test.ts"],
extends: [
"plugin:@walgreenshealth/recommended",
"plugin:@walgreenshealth/typescript",
"plugin:@walgreenshealth/jest",
],
parserOptions: typescriptParserOptions,
},
{
files: ["**/*.cjs"],
parserOptions: {
sourceType: "script",
},
env: {
node: true,
},
extends: ["plugin:@walgreenshealth/recommended"],
rules: {
"import/no-commonjs": "off",
"import/no-extraneous-dependencies": [
"error",
{ devDependencies: true },
],
},
},
{
files: ["scripts/*.mjs"],
parserOptions: {
sourceType: "module",
},
env: {
node: true,
},
extends: ["plugin:@walgreenshealth/recommended"],
rules: {
"no-console": "off",
"import/no-extraneous-dependencies": [
"error",
{ devDependencies: true },
],
},
},
],
plugins: ["@walgreenshealth/eslint-plugin"],
};