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

Migrate to neostandard #951

Merged
merged 1 commit into from
Oct 13, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion dist/client-side-validations.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ function isAMD() {
return typeof define === 'function' && define.amd; // eslint-disable-line no-undef
}
function isCommonJS() {
return (typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined'; // eslint-disable-line no-undef
return (typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined';
}

export { ClientSideValidations as default };
2 changes: 1 addition & 1 deletion dist/client-side-validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@
return typeof define === 'function' && define.amd; // eslint-disable-line no-undef
}
function isCommonJS() {
return (typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined'; // eslint-disable-line no-undef
return (typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined';
}

return ClientSideValidations;
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 @@ -18,7 +18,7 @@
},
"homepage": "https://github.com/DavyJonesLocker/client_side_validations",
"scripts": {
"build": "standard --verbose && rollup -c",
"build": "rollup -c",
"test": "test/javascript/run-qunit.mjs"
},
"devDependencies": {
Expand All @@ -27,10 +27,11 @@
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-node-resolve": "^15.3.0",
"chrome-launcher": "^1.1.2",
"eslint": "^9.12.0",
"neostandard": "^0.11.6",
"puppeteer-core": "^23.5.3",
"rollup": "^4.24.0",
"rollup-plugin-copy": "^3.5.0",
"standard": "^17.1.2"
"rollup-plugin-copy": "^3.5.0"
},
"peerDependencies": {
"jquery": ">= 1.12.4 < 4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ function isAMD () {
}

function isCommonJS () {
return typeof exports === 'object' && typeof module !== 'undefined' // eslint-disable-line no-undef
return typeof exports === 'object' && typeof module !== 'undefined'
}

export default ClientSideValidations
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
2 changes: 1 addition & 1 deletion vendor/assets/javascripts/rails.validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@
return typeof define === 'function' && define.amd; // eslint-disable-line no-undef
}
function isCommonJS() {
return (typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined'; // eslint-disable-line no-undef
return (typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined';
}

return ClientSideValidations;
Expand Down
Loading