Skip to content

Commit

Permalink
Add es lint and fix all linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
LouiseMcMahon committed Jan 29, 2025
1 parent 06e08b8 commit 446214a
Show file tree
Hide file tree
Showing 29 changed files with 1,945 additions and 188 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build-vue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build Vue

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
eslint:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [8.4]

steps:
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
- run: npm install

- run: npm run build
27 changes: 27 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Run JS Linter

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
eslint:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [8.4]

steps:
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
- run: npm install

- run: npm run lint
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml → .github/workflows/php-lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run Linter
name: Run PHP Linter

on:
push:
Expand All @@ -9,7 +9,7 @@ on:
- main

jobs:
lint:
phpLint:
runs-on: ubuntu-latest
strategy:
fail-fast: true
Expand Down
47 changes: 47 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import eslint from '@eslint/js';
import eslintPluginVue from 'eslint-plugin-vue';
import globals from 'globals';
import typescriptEslint from 'typescript-eslint';
import {includeIgnoreFile} from "@eslint/compat";
import path from "node:path";
import {fileURLToPath} from "node:url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, ".gitignore");

/** @type {import('eslint').Linter.Config[]} */
export default [
includeIgnoreFile(gitignorePath),
{
files: [".resources/js/**/*.{js,mjs,cjs,ts,vue}"],
},
{
files: [".resources/js/**/*.js"], languageOptions: {sourceType: "script"},
},
eslint.configs.recommended,
...typescriptEslint.configs.recommended,
...eslintPluginVue.configs['flat/recommended'],
{
files: ['**/*.{ts,vue}'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
...globals.commonjs,
...{
"App": 'readonly',
"route": 'readonly',
}
},
parserOptions: {
parser: typescriptEslint.parser,
},
},
rules: {
"vue/html-indent": ["error", 4],
"vue/multi-word-component-names": ["off"]
}
}
];
Loading

0 comments on commit 446214a

Please sign in to comment.