mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
Improve eslint rules and run them from CI
This commit is contained in:
parent
2c522637ef
commit
637a4dc1f9
32
.eslintrc.js
32
.eslintrc.js
@ -33,14 +33,22 @@ module.exports = {
|
||||
"sourceType": "module",
|
||||
},
|
||||
'rules': {
|
||||
// -------------------------------
|
||||
// Code correctness
|
||||
// -------------------------------
|
||||
"react/jsx-uses-react": "error",
|
||||
"react/jsx-uses-vars": "error",
|
||||
// Ignore all unused function arguments, because in some
|
||||
// case they are kept to indicate the function signature.
|
||||
//"no-unused-vars": ["error", { "argsIgnorePattern": ".*" }],
|
||||
"@typescript-eslint/no-unused-vars": ["error"],
|
||||
"no-unused-vars": "error",
|
||||
"no-constant-condition": 0,
|
||||
"no-prototype-builtins": 0,
|
||||
// This error is always a false positive so far since it detects
|
||||
// possible race conditions in contexts where we know it cannot happen.
|
||||
"require-atomic-updates": 0,
|
||||
"no-lonely-if": "error",
|
||||
|
||||
// -------------------------------
|
||||
// Formatting
|
||||
// -------------------------------
|
||||
"space-in-parens": ["error", "never"],
|
||||
"semi": ["error", "always"],
|
||||
"eol-last": ["error", "always"],
|
||||
@ -49,11 +57,19 @@ module.exports = {
|
||||
"comma-dangle": ["error", "always-multiline"],
|
||||
"no-trailing-spaces": "error",
|
||||
"linebreak-style": ["error", "unix"],
|
||||
// This error is always a false positive so far since it detects
|
||||
// possible race conditions in contexts where we know it cannot happen.
|
||||
"require-atomic-updates": 0,
|
||||
"prefer-template": ["error"],
|
||||
"template-curly-spacing": ["error", "never"]
|
||||
"template-curly-spacing": ["error", "never"],
|
||||
"key-spacing": ["error", {
|
||||
"beforeColon": false,
|
||||
"afterColon": true,
|
||||
"mode": "strict"
|
||||
}],
|
||||
"block-spacing": ["error"],
|
||||
"brace-style": ["error", "1tbs"],
|
||||
"no-spaced-func": ["error"],
|
||||
"func-call-spacing": ["error"],
|
||||
"space-before-function-paren": ["error", "never"],
|
||||
"object-property-newline": ["error"]
|
||||
},
|
||||
"plugins": [
|
||||
"react",
|
||||
|
17
.travis.yml
17
.travis.yml
@ -55,17 +55,30 @@ before_install:
|
||||
script:
|
||||
- |
|
||||
# Install tools
|
||||
npm install
|
||||
cd Tools
|
||||
npm install
|
||||
cd ..
|
||||
|
||||
# Run test units
|
||||
cd ../CliClient
|
||||
cd CliClient
|
||||
npm install
|
||||
./run_test.sh
|
||||
testResult=$?
|
||||
if [ $testResult -ne 0 ]; then
|
||||
exit $testResult
|
||||
fi
|
||||
cd ..
|
||||
|
||||
# Run linter for pull requests only - this is so that
|
||||
# bypassing eslint is allowed for urgent fixes.
|
||||
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
||||
npm run linter-ci ./
|
||||
testResult=$?
|
||||
if [ $testResult -ne 0 ]; then
|
||||
exit $testResult
|
||||
fi
|
||||
fi
|
||||
|
||||
# Find out if we should run the build or not. Electron-builder gets stuck when
|
||||
# builing PRs so we disable it in this case. The Linux build should provide
|
||||
@ -78,6 +91,6 @@ script:
|
||||
fi
|
||||
|
||||
# Prepare the Electron app and build it
|
||||
cd ../ElectronClient/app
|
||||
cd ElectronClient/app
|
||||
rsync -aP --delete ../../ReactNativeClient/lib/ lib/
|
||||
npm install && USE_HARD_LINKS=false yarn dist
|
||||
|
@ -3,7 +3,8 @@
|
||||
"version": "1.0.0",
|
||||
"description": "Joplin root package for linting",
|
||||
"scripts": {
|
||||
"linter": "./node_modules/.bin/eslint --fix --ext .js --ext .jsx"
|
||||
"linter": "./node_modules/.bin/eslint --fix --ext .js --ext .jsx",
|
||||
"linter-ci": "./node_modules/.bin/eslint --ext .js --ext .jsx"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
Loading…
Reference in New Issue
Block a user