The @arcanis personal collection of ESLint rules.
I tend to have strong personal preferences about what readable code should look like, and they don't always match how the Prettier rules would work. This repo contains some ESLint rules that help enforce my style at no cost for other contributors, as they are all intended to be autofixable.
Most of these rules are available as a preset via @yarnpkg/eslint-config
.
Assuming you have ESLint installed, just install eslint-plugin-arca
:
yarn add -D eslint-plugin-arca
Add arca
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"arca"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"arca/curly": 2,
"arca/import-absolutes": 2,
"arca/import-align": 2,
"arca/import-ordering": 2,
"arca/jsx-longhand-props": 2,
"arca/melted-constructs": 2,
"arca/newline-after-import-section": 2,
"arca/no-default-export": 2
}
}
Note: all these rules are autofixed. This is why some may look duplicate with others that aren't (for instance arca/jsx-import-react
is autofixable, but react/react-in-jsx-scope
isn't).
arca/curly
- ensure that curly braces keep the code flow easy to readarca/import-absolutes
- ensure that imports are always package-absolutearca/import-align
- requirefrom
keywords to be alignedarca/import-ordering
- ensure that each import in the file is correctly ordered relative to the othersarca/jsx-import-react
- require JSX files to importReact
arca/jsx-longhand-props
- require JSX props to be passed using the longhand syntaxarca/jsx-no-html-attrs
- autofix HTML attribute names into their React propsarca/jsx-no-string-styles
- autofix stringstyles
props into objectsarca/melted-constructs
- enforce the use of melted constructs when possiblearca/newline-after-import-section
- require an empty newline after an import sectionarca/no-default-export
- disallow default exports
Copyright © 2016 Maël Nison
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.