Skip to content
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ jobs:
# Lint all
lint-js-and-ruby:
docker:
- image: &docker_image cimg/ruby:3.3.0-browsers
- image: &docker_image cimg/ruby:3.3.7-browsers
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous version includes Node 20.10, which doesn't have import.meta.dirname. Other Ruby version changes are for consistency with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or I could replace import.meta.dirname with the older approach.

steps:
- checkout
- run: *print-system-info
Expand Down
2 changes: 1 addition & 1 deletion .controlplane/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:3.3.0
FROM ruby:3.3.7

RUN apt-get update

Expand Down
22 changes: 0 additions & 22 deletions .eslintignore

This file was deleted.

91 changes: 0 additions & 91 deletions .eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion Gemfile.development_dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '3.3.0'
ruby '3.3.7'

gem "react_on_rails", "15.0.0.alpha.2" # keep in sync with package.json files

Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ DEPENDENCIES
yard

RUBY VERSION
ruby 3.3.0p0
ruby 3.3.7p123

BUNDLED WITH
2.5.4
177 changes: 177 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
import path from 'node:path';
import { includeIgnoreFile } from '@eslint/compat';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';
import { defineConfig, globalIgnores } from 'eslint/config';
import importPlugin from 'eslint-plugin-import';
import jest from 'eslint-plugin-jest';
import prettierRecommended from 'eslint-plugin-prettier/recommended';
import globals from 'globals';
import typescriptEslint from 'typescript-eslint';

const compat = new FlatCompat({
baseDirectory: import.meta.dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default defineConfig([
includeIgnoreFile(path.resolve(import.meta.dirname, '.gitignore')),
globalIgnores([
'**/node_modules',
'**/coverage',
'gen-documentation/**/*',
'spec/react_on_rails/dummy-for-generators',
'spec/dummy',
'spec/execjs-compatible-dummy',
'packages/node-renderer/lib/',
'packages/node-renderer/tests/fixtures',
'packages/node-renderer/webpack.config.js',
'**/node_modules/**/*',
'**/assets/webpack/**/*',
'**/generated/**/*',
'**/app/assets/javascripts/application.js',
'**/coverage/**/*',
'**/cable.js',
'**/public/**/*',
'**/tmp/**/*',
'**/vendor',
'**/dist',
'**/.yalc/',
]),
{
files: ['**/*.[jt]s', '**/*.[cm][jt]s', '**/*.[jt]sx'],
},
js.configs.recommended,
compat.extends('eslint-config-shakacode'),
{
languageOptions: {
globals: globals.node,

parserOptions: {
// We have @babel/eslint-parser from eslint-config-shakacode, but don't use Babel in the main project
requireConfigFile: false,
},
},

settings: {
'import/extensions': ['.js', '.ts'],

'import/parsers': {
'@typescript-eslint/parser': ['.ts'],
},

'import/resolver': {
node: true,
typescript: true,
},
},

rules: {
'no-console': 'off',

'no-void': [
'error',
{
// Allow using void to suppress errors about misused promises
allowAsStatement: true,
},
],

// Allow using void to suppress errors about misused promises
'no-restricted-syntax': 'off',
// https://github.com/benmosher/eslint-plugin-import/issues/340
'import/no-extraneous-dependencies': 'off',
'import/extensions': 'off',
'import/prefer-default-export': 'off',
'lines-between-class-members': [
'error',
{
enforce: [
{ blankLine: 'always', prev: '*', next: '*' },
{ blankLine: 'never', prev: 'field', next: 'field' },
],
},
],
'no-mixed-operators': 'off',
},
},
{
files: ['**/*.ts{x,}'],
extends: [importPlugin.flatConfigs.typescript, typescriptEslint.configs.strictTypeChecked],

languageOptions: {
parserOptions: {
projectService: true,
},
},

rules: {
'@typescript-eslint/restrict-template-expressions': 'off',

'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],

'@typescript-eslint/no-floating-promises': [
'error',
{
allowForKnownSafePromises: [
{
from: 'package',
package: 'fastify',
name: 'FastifyReply',
},
],
},
],

'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
},
},
{
files: ['packages/node-renderer/tests/**'],

plugins: {
jest,
},

languageOptions: {
globals: globals.jest,
},

rules: {
// Allows Jest mocks before import
'import/first': 'off',
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/prefer-to-have-length': 'warn',
'jest/valid-expect': 'error',
// Simplifies test code
'@typescript-eslint/no-non-null-assertion': 'off',
},
},
{
files: ['packages/node-renderer/src/integrations/**'],
ignores: ['packages/node-renderer/src/integrations/api.ts'],

rules: {
// Integrations should only use the public integration API
'no-restricted-imports': [
'error',
{
patterns: ['../*'],
},
],
},
},
// must be the last config in the array
// https://github.com/prettier/eslint-plugin-prettier?tab=readme-ov-file#configuration-new-eslintconfigjs
prettierRecommended,
]);
2 changes: 1 addition & 1 deletion package-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ scripts:
eslint:
default:
description: Run eslint.
script: eslint . --ext ".js,.mts,.mjs,.jsx,.ts,.tsx" --report-unused-disable-directives
script: eslint . --report-unused-disable-directives
fix:
description: Run eslint and auto-fix.
script: nps "eslint --fix"
Expand Down
20 changes: 11 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@babel/eslint-parser": "^7.24.1",
"@babel/preset-env": "^7.12.1",
"@babel/preset-typescript": "^7.24.1",
"@eslint/compat": "^1.2.8",
"@honeybadger-io/js": "^6.10.1",
"@sentry/node": "^7.120.0",
"@tsconfig/node14": "^14.1.2",
Expand All @@ -60,18 +61,19 @@
"@types/touch": "^3.1.5",
"babel-jest": "^29.7.0",
"concurrently": "^9.1.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint": "^9.24.0",
"eslint-config-prettier": "^10.1.1",
"eslint-config-shakacode": "^19.0.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-import-resolver-typescript": "^4.3.2",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^28.11.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-prettier": "^5.2.6",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"form-auto-content": "^3.2.1",
"form-data": "^4.0.1",
"globals": "^16.0.0",
"husky": "^4.3.6",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ DEPENDENCIES
webmock

RUBY VERSION
ruby 3.3.0p0
ruby 3.3.7p123

BUNDLED WITH
2.5.4
2 changes: 1 addition & 1 deletion spec/execjs-compatible-dummy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax = docker/dockerfile:1

# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.3.0
ARG RUBY_VERSION=3.3.7
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base

# Rails app lives here
Expand Down
2 changes: 1 addition & 1 deletion spec/execjs-compatible-dummy/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source "https://rubygems.org"

ruby "3.3.0"
ruby "3.3.7"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.1", ">= 7.1.3.2"
Expand Down
Loading