@regionhalland/eslint-config

1.9.1 • Public • Published

@regionhalland/eslint-config

To use this package, the following packages must be installed in the consuming project.

  • ESLint
  • TypeScript
  • Prettier

Recommended installation:

yarn add -D eslint typescript prettier @regionhalland/eslint-config

Sample configuration for package.json:

// package.json
{
	...
	"script": {
		"lint": "eslint ./src",
		"lint:fix": "eslint ./src --fix"
	}
	...
}

Configuration for React application:

  • @regionhalland/eslint-config is standard config.
  • @regionhalland/eslint-config/recommended is recommended config with addition of the plugin simple-import-sort.
// .eslintrc.cjs
module.exports = {
	extends: "@regionhalland/eslint-config",
	rules: {
		"no-restricted-imports": [
			"error",
			{
				patterns: [
					"@/features/*/*"
				]
			}
		]
	},
};

Configuration for Node.js application:

// .eslintrc.cjs
module.exports = {
	extends: "@regionhalland/eslint-config/node",
};

Merge config:

// .eslintrc.cjs
const defaultConfig = require('@regionhalland/eslint-config/recommended');
const { mergeRules } = require('@regionhalland/eslint-config/utils');

// Modify a part of existing rule
const extendedRules = {
	'@typescript-eslint/naming-convention': [
		'warn',
		{
			selector: 'parameter',
			format: ['camelCase', 'UPPER_CASE'],
			leadingUnderscore: 'allow',
		},
	]
};

const eslintRules = mergeRules(defaultConfig['rules'], extendedRules);

module.exports = {
	extends: "@regionhalland/eslint-config/recommended",
	rules: {
		...eslintRules
	},
	ignorePatterns: [
		"*.cjs"
	]
};

Package Sidebar

Install

npm i @regionhalland/eslint-config

Weekly Downloads

21

Version

1.9.1

License

CC-BY-NC-SA-4.0

Unpacked Size

22.6 kB

Total Files

11

Last publish

Collaborators

  • tlqvst
  • joelsanden