✨ Linters
Follow the Ciphera style guidelines using your preferred liner already configured.
Overview
Here you will find the ready configuration for your flashlight.
Remember to check this page frequently for updates!
Node
First, make sure you have ESLint installed in your project. You can do this with npm or yarn:
npm install eslint --save-dev
# or
yarn add eslint --dev
Then start the ESLint configuration by running:
npx eslint --init
After creating the .eslintrc.json file, enter the following:
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"indent": ["error", 4],
"quotes": ["error", "double"],
"semi": ["error", "always"],
"no-use-before-define": ["error", { "functions": false, "classes": true }],
"no-undef": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/explicit-module-boundary-types": "off",
"import/order": ["error", {
"groups": [["builtin", "external", "internal"]],
"newlines-between": "always",
"alphabetize": { "order": "asc", "caseInsensitive": true }
}],
"no-extra-boolean-cast": "error",
"no-unnecessary-boolean-literal-compare": "error",
"no-duplicate-imports": ["error", { "includeExports": true }],
"no-extra-semi": "error",
"object-curly-newline": ["error", { "multiline": true, "minProperties": 4 }]
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".mjs", ".cjs", ".jsx", ".ts", ".tsx"]
}
}
}
}
Python
First, install Pylint using pip:
pip install pylint
Create a .pylintrc file with the following content:
[MASTER]
ignore=tests
[FORMAT]
max-line-length=100
[MESSAGES CONTROL]
disable=C0111, C0301
C
First, install Cppcheck using your package manager. For example, on Ubuntu:
sudo apt-get install cppcheck
Run Cppcheck with the following command:
cppcheck --enable=all --std=c++11 src/
Java
Download Checkstyle from the official site.
Run Checkstyle with the following command:
java -jar checkstyle-<version>-all.jar -c /google_checks.xml src/
Create a checkstyle.xml file with the following content:
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//PARSER//DTD CHECKSTYLE MODULE 1.0//EN"
"https://checkstyle.sourceforge.io/dtds/configuration_1_0.dtd">
<module name="Checker">
<module name="TreeWalker">
<module name="AvoidNestedBlocks"/>
</module>
</module>
Ruby
First, install RuboCop using gem:
gem install rubocop
Create a .rubocop.yml file with the following content:
Layout/LineLength:
Max: 100
Metrics/MethodLength:
Max: 20
Go
First, install golint using go get:
go install golang.org/x/lint/golint@latest
Run golint with the following command:
golint ./...