diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..efc98776 --- /dev/null +++ b/.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 diff --git a/README.md b/README.md index 8c960b75..3d01a72d 100644 --- a/README.md +++ b/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) diff --git a/index.js b/index.js index 4333698c..4bc74843 100644 --- a/index.js +++ b/index.js @@ -11,6 +11,7 @@ module.exports = { parserOptions: { parser: '@babel/eslint-parser', ecmaVersion: 6, + requireConfigFile: false, }, extends: [ 'eslint:recommended', @@ -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'], @@ -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'], diff --git a/package.json b/package.json index 0513fac8..fefb6df8 100644 --- a/package.json +++ b/package.json @@ -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",