Security News
Python Overtakes JavaScript as Top Programming Language on GitHub
Python becomes GitHub's top language in 2024, driven by AI and data science projects, while AI-powered security tools are gaining adoption.
eslint-plugin-perfectionist
Advanced tools
eslint-plugin-perfectionist is an ESLint plugin designed to enforce consistent code style and formatting rules. It helps developers maintain a clean and organized codebase by providing rules for sorting and organizing various code elements such as imports, properties, and more.
Sort Imports
This rule enforces a specific order for import statements. In this example, the order is set to 'builtin', 'external', and 'internal' imports.
module.exports = {
"rules": {
"perfectionist/sort-imports": ["error", {
"order": ["builtin", "external", "internal"]
}]
}
};
Sort Object Properties
This rule enforces sorting of object properties in ascending order. The 'caseSensitive' option ensures that the sorting is case-sensitive.
module.exports = {
"rules": {
"perfectionist/sort-keys": ["error", "asc", {
"caseSensitive": true,
"natural": false
}]
}
};
Sort Class Members
This rule enforces a specific order for class members. In this example, the order is set to 'field', 'constructor', and 'method'.
module.exports = {
"rules": {
"perfectionist/sort-class-members": ["error", {
"order": ["field", "constructor", "method"]
}]
}
};
eslint-plugin-import is a popular ESLint plugin that provides rules for ensuring proper import/export syntax and order. It focuses on managing module imports and exports, ensuring they are used correctly and consistently.
eslint-plugin-sort-keys-fix is an ESLint plugin that automatically sorts object keys in a consistent order. It is similar to the 'sort-keys' rule in eslint-plugin-perfectionist but focuses specifically on object keys.
eslint-plugin-jsdoc is an ESLint plugin that enforces JSDoc comments and their formatting. While it doesn't focus on sorting, it helps maintain consistent documentation style, which complements the goals of eslint-plugin-perfectionist.
ESLint plugin for code formatting in perfectionist style.
You'll first need to install ESLint:
npm install --save-dev eslint
Next, install eslint-plugin-perfectionist
:
npm install --save-dev eslint-plugin-perfectionist
Name | Description | 💼 | 🛠 |
---|---|---|---|
sort-array-includes | Enforce sorted arrays before include method | ✅ | 🔧 |
sort-interfaces | Enforce sorted interface properties | ✅ | 🔧 |
sort-jsx-props | Enforce sorted JSX props | ✅ | 🔧 |
sort-map-elements | Enforce sorted Map elements | ✅ | 🔧 |
sort-named-exports | Enforce sorted named exports | ✅ | 🔧 |
sort-named-imports | Enforce sorted named imports | ✅ | 🔧 |
sort-union-types | Enforce sorted union types | ✅ | 🔧 |
@azat-io/eslint-config
- Collection of ESLint configsMIT © Azat S.
FAQs
ESLint plugin for sorting various data such as objects, imports, types, enums, JSX props, etc.
The npm package eslint-plugin-perfectionist receives a total of 308,038 weekly downloads. As such, eslint-plugin-perfectionist popularity was classified as popular.
We found that eslint-plugin-perfectionist demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Python becomes GitHub's top language in 2024, driven by AI and data science projects, while AI-powered security tools are gaining adoption.
Security News
Dutch National Police and FBI dismantle Redline and Meta infostealer malware-as-a-service operations in Operation Magnus, seizing servers and source code.
Research
Security News
Socket is tracking a new trend where malicious actors are now exploiting the popularity of LLM research to spread malware through seemingly useful open source packages.