Skip to content

Commit

Permalink
Configure npm lint commands
Browse files Browse the repository at this point in the history
  • Loading branch information
timbeccue committed Oct 2, 2022
1 parent d405a96 commit 3218cbe
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 66 deletions.
41 changes: 21 additions & 20 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ module.exports = {
'standard'
],
globals: {
"A": true, // Aladin script
"JS9": true,
"$": true,
"d3": true,
"google": true,
"OverlappingMarkerSpiderfier": true,
A: true, // Aladin script
JS9: true,
$: true,
d3: true,
google: true,
OverlappingMarkerSpiderfier: true,
_chatlio: true
},
overrides: [
],
Expand All @@ -23,25 +24,25 @@ module.exports = {
},
plugins: [
'vue',
'no-autofix',
'no-autofix'
],
rules: {
"camelcase": "off",
"eqeqeq": "off",
"brace-style": "off",
"vue/require-prop-type-constructor": "off",
"vue/prop-name-casing": "off",
"vue/require-default-prop": "off",
"vue/require-prop-types": "off",
"vue/order-in-components": "off",
"vue/multi-word-component-names": "off",
'camelcase': 'off',
'eqeqeq': 'off',
'brace-style': 'off',
'vue/require-prop-type-constructor': 'off',
'vue/prop-name-casing': 'off',
'vue/require-default-prop': 'off',
'vue/require-prop-types': 'off',
'vue/order-in-components': 'off',
'vue/multi-word-component-names': 'off',

/* Don't automatically fix these when running `eslint --fix`, but keep the warning/error */

// This autofix induced breaking changes when props are named with a mix of camelCase and snake_case,
// such as in SiteCalendar by changing the prop for TheCalendar (fc_timeZone)
// This autofix induced breaking changes when props are named with a mix of camelCase and snake_case,
// such as in SiteCalendar by changing the prop for TheCalendar (fc_timeZone)
// from 'fc_timeZone' to 'fc-time-zone'
"vue/attribute-hyphenation": "off",
"no-autofix/vue/attribute-hyphenation": "error",
'vue/attribute-hyphenation': 'off',
'no-autofix/vue/attribute-hyphenation': 'error'
}
}
48 changes: 48 additions & 0 deletions .eslintrc_strict.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
module.exports = {
env: {
browser: true,
es2021: true
},
extends: [
'plugin:vue/recommended', // for Vue 2.x
'standard'
],
globals: {
"A": true, // Aladin script
"JS9": true,
"$": true,
"d3": true,
"google": true,
"OverlappingMarkerSpiderfier": true,
"_chatlio": true,
},
overrides: [
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
plugins: [
'vue',
'no-autofix',
],
rules: {
"camelcase": "off",
'eqeqeq': 'off',
'brace-style': 'off',
"vue/require-prop-type-constructor": "off",
"vue/prop-name-casing": "off",
"vue/require-default-prop": "off",
"vue/require-prop-types": "off",
"vue/order-in-components": "off",
"vue/multi-word-component-names": "off",

/* Don't automatically fix these when running `eslint --fix`, but keep the warning/error */

// This autofix induced breaking changes when props are named with a mix of camelCase and snake_case,
// such as in SiteCalendar by changing the prop for TheCalendar (fc_timeZone)
// from 'fc_timeZone' to 'fc-time-zone'
"vue/attribute-hyphenation": "off",
"no-autofix/vue/attribute-hyphenation": "error",
}
}
6 changes: 6 additions & 0 deletions .github/super-linter.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
VALIDATE_DOCKERFILE_HADOLINT=false
VALIDATE_EDITORCONFIG=false
VALIDATE_GITLEAKS=false
VALIDATE_ALL_CODEBASE=false
LINTER_RULES_PATH=/
JAVASCRIPT_ES_CONFIG_FILE=.eslintrc.js
54 changes: 9 additions & 45 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,19 @@
---
#################################
#################################
## Super Linter GitHub Actions ##
#################################
#################################
name: Lint Code Base

#
# Documentation:
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
#

#############################
# Start the job on all push #
#############################
on:
on:
push:
branches-ignore: [dev]
# Remove the line above to run when pushing to dev
pull_request:
branches: [dev]

###############
# Set the Job #
###############

jobs:
build:
# Name the Job
name: Lint Code Base
# Set the agent to run on
runs-on: ubuntu-latest

##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v3
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0

################################
# Run Linter against code base #
################################
- name: Lint Code Base
uses: github/super-linter/slim@v4
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: dev
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- name: Install modules
run: npm ci
- name: Lint all files
run: npm run lint:check
- name: Strict lint for changes
run: npm run lint-changes:check
60 changes: 60 additions & 0 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
#################################
#################################
## Super Linter GitHub Actions ##
#################################
#################################
name: Lint Code Base

#
# Documentation:
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
#

#############################
# Start the job on all push #
#############################
on:
push:
branches-ignore: [dev]
# Remove the line above to run when pushing to dev
pull_request:
branches: [dev]

###############
# Set the Job #
###############
jobs:
build:
# Name the Job
name: Lint Code Base
# Set the agent to run on
runs-on: ubuntu-latest

##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v3
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0

#############################
# Set environment variables #
#############################
- run: cat .github/super-linter.env >> "$GITHUB_ENV"


################################
# Run Linter against code base #
################################
- name: Lint Code Base
uses: github/super-linter/slim@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BRANCH: dev
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "eslint",
"lint:check": "eslint src",
"lint:fix": "eslint src --fix",
"lint-strict:check": "eslint -c .eslintrc_strict.js src",
"lint-strict:fix": "eslint -c .eslintrc_strict.js src --fix",
"lint-changes:check": "eslint -c .eslintrc_strict.js $(git diff --name-only --diff-filter=ACMRTUXB dev | grep -E \"(.js$|.vue$)\")",
"lint-changes:fix": "eslint -c .eslintrc_strict.js $(git diff --name-only --diff-filter=ACMRTUXB dev | grep -E \"(.js$|.vue$)\") --fix",
"cypress:open": "cypress open"
},
"dependencies": {
Expand Down

0 comments on commit 3218cbe

Please sign in to comment.