Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add scripts for linting the config and fixed issues found #434

Merged
merged 2 commits into from Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/lint.yml
@@ -0,0 +1,49 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization

name: Lint

on:
pull_request:
push:
branches:
- main
- master
- stable*

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

name: lint
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@v2
id: versions
with:
fallbackNode: '^16'
fallbackNpm: '^8'

- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@v3
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}

- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"

- name: Install dependencies
run: |
npm ci

- name: Lint
run: |
npm run lint
2 changes: 1 addition & 1 deletion README.md
@@ -1,7 +1,7 @@
## @nextcloud/eslint-config

[![npm last version](https://img.shields.io/npm/v/@nextcloud/eslint-config.svg?style=flat-square)](https://www.npmjs.com/package/@nextcloud/eslint-config)
[![travis build status](https://img.shields.io/travis/com/nextcloud/eslint-config/master.svg?style=flat-square)](https://travis-ci.com/nextcloud/eslint-config)
[![Lint status](https://img.shields.io/github/actions/workflow/status/nextcloud/eslint-config/lint.yml?label=lint&style=flat-square)](https://github.com/nextcloud/eslint-config/actions/workflows/lint.yml)
[![Dependabot status](https://img.shields.io/badge/Dependabot-enabled-brightgreen.svg?longCache=true&style=flat-square&logo=dependabot)](https://dependabot.com)


Expand Down
7 changes: 4 additions & 3 deletions index.js
Expand Up @@ -11,6 +11,7 @@ module.exports = {
parserOptions: {
parser: '@babel/eslint-parser',
ecmaVersion: 6,
requireConfigFile: false,
},
extends: [
'eslint:recommended',
Expand Down Expand Up @@ -91,8 +92,8 @@ module.exports = {
multiline: 1,
}],
'vue/first-attribute-linebreak': ['error', {
'singleline': 'beside',
'multiline': 'beside',
singleline: 'beside',
multiline: 'beside',
}],
// Allow single-word components names
'vue/multi-word-component-names': ['off'],
Expand All @@ -106,7 +107,7 @@ module.exports = {
// Allow shallow import of @vue/test-utils and @testing-library/vue in order to be able to use it in
// the src folder
'n/no-unpublished-import': ['error', {
'allowModules': ['@vue/test-utils', '@testing-library/vue'],
allowModules: ['@vue/test-utils', '@testing-library/vue'],
}],
// require object literal shorthand syntax
'object-shorthand': ['error', 'always'],
Expand Down
4 changes: 4 additions & 0 deletions package.json
Expand Up @@ -7,6 +7,10 @@
"type": "git",
"url": "git+https://github.com/nextcloud/eslint-config.git"
},
"scripts": {
"lint": "eslint -c index.js *.js",
"lint:fix": "eslint -c index.js --fix *.js"
},
"peerDependencies": {
"@babel/core": "^7.13.10",
"@babel/eslint-parser": "^7.16.5",
Expand Down