Skip to content

Commit

Permalink
Migrate to neostandard
Browse files Browse the repository at this point in the history
  • Loading branch information
tagliala committed Oct 13, 2024
1 parent 90cc5a0 commit c4c1a0d
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 6 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: ESLint

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: read

jobs:
eslint:
name: ESLint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install node dependencies
run: pnpm install
- name: Run JavaScript linter
run: pnpm eslint
2 changes: 1 addition & 1 deletion .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Ruby linter
run: bundle exec rubocop
run: bundle exec rubocop -f github
7 changes: 6 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ task default: [:rubocop, 'test:ruby']
require 'rake/testtask'
namespace :test do
desc %(Run all tests)
task all: [:rubocop, 'test:ruby', 'test:js']
task all: [:rubocop, :lint_javascript, 'test:ruby', 'test:js']

desc %(Test Ruby code)
Rake::TestTask.new(:ruby) do |test|
Expand Down Expand Up @@ -53,6 +53,11 @@ namespace :test do
end
end

desc %(Lint JavaScript files)
task :lint_javascript do
run_pnpm_script 'eslint'
end

desc %(Regenerate JavaScript files)
task :regenerate_javascript do
run_pnpm_script 'build'
Expand Down
13 changes: 13 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import neostandard from 'neostandard'

export default [
{
ignores: [
'coverage/**/*.js',
'dist/**/*.js',
'test/**/*.js',
'vendor/**/*.js',
]
},
...neostandard()
]
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"homepage": "https://github.com/DavyJonesLocker/client_side_validations-simple_form",
"scripts": {
"build": "standard --verbose && rollup -c",
"build": "rollup -c",
"test": "test/javascript/run-qunit.mjs"
},
"devDependencies": {
Expand All @@ -28,10 +28,11 @@
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-node-resolve": "^15.2.1",
"chrome-launcher": "^1.1.2",
"eslint": "^9.12.0",
"neostandard": "^0.11.6",
"puppeteer-core": "^23.3.0",
"rollup": "^4.21.3",
"rollup-plugin-copy": "^3.5.0",
"standard": "^17.1.2"
"rollup-plugin-copy": "^3.5.0"
},
"peerDependencies": {
"@client-side-validations/client-side-validations": "^0.4.0"
Expand Down
4 changes: 3 additions & 1 deletion test/javascript/run-qunit.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ export default (async () => {
return new Promise(resolve => setTimeout(resolve, ms))
}

let browser

try {
const chromeExecutablePath = chromeLauncher.Launcher.getInstallations()[0]
const browser = await puppeteer.launch({ executablePath: chromeExecutablePath, headless: 'new' })
browser = await puppeteer.launch({ executablePath: chromeExecutablePath, headless: 'new' })
const page = await browser.newPage()

// Attach to browser console log events, and log to node console
Expand Down

0 comments on commit c4c1a0d

Please sign in to comment.