Skip to content

Commit 2d5a529

Browse files
authored
Resolve 14.1.1 incompatibility with eslint & make sure that spec/dummy is linted by eslint (#1693)
* add main property back to package.json to reenable eslint support * lint spec/dummy
1 parent efae154 commit 2d5a529

24 files changed

+110
-68
lines changed

.eslintignore

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
node_modules
21
coverage
32
spec/react_on_rails/dummy-for-generators
4-
spec/dummy
3+
spec/dummy/.yalc
4+
spec/dummy/public
5+
spec/dummy/vendor
6+
spec/dummy/tmp
7+
spec/dummy/app/assets/config/manifest.js
8+
spec/dummy/client/app/components/HelloWorldReScript.res.js
59
node_package/lib/
6-
node_package/tests/node_modules
7-
node_package/webpack.config.js
810
**/node_modules/**
911
**/assets/webpack/**
1012
**/public/webpack/**

.eslintrc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,19 @@ rules:
4141
object-curly-newline: 0
4242
no-restricted-syntax: ["error", "SequenceExpression"]
4343
# https://stackoverflow.com/a/59268871/5241481
44-
import/extensions: ['error', 'ignorePackages', {"js": 'never',"ts": "never"}]
44+
import/extensions: ['error', 'ignorePackages', {"js": 'never', "jsx": 'never', "ts": "never"}]
45+
import/first: 0
4546

4647
# https://github.com/benmosher/eslint-plugin-import/issues/340
4748
import/no-extraneous-dependencies: 0
4849

50+
react/forbid-prop-types: 0
51+
jsx-a11y/anchor-is-valid: 0
52+
4953
settings:
5054
import/core-modules:
5155
- react-redux
5256
import/resolver:
57+
alias: [ ["Assets", "./spec/dummy/client/app/assets"] ]
5358
node:
54-
extensions: [".js", ".ts", ".d.ts"]
59+
extensions: [".js", ".jsx", ".ts", ".d.ts"]

.github/workflows/lint-js-and-ruby.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,29 @@ jobs:
4545
- name: Install Node modules with Yarn for renderer package
4646
run: |
4747
yarn install --no-progress --no-emoji
48+
sudo yarn global add yalc
49+
- name: yalc publish for react-on-rails
50+
run: yalc publish
51+
- name: Save spec/dummy/node_modules to cache
52+
uses: actions/cache@v4
53+
with:
54+
path: spec/dummy/node_modules
55+
key: dummy-app-node-modules-cache-${{ hashFiles('spec/dummy/package.json') }}-newest
56+
- name: yalc add react-on-rails
57+
run: cd spec/dummy && yalc add react-on-rails
58+
- name: Install Node modules with Yarn for dummy app
59+
run: cd spec/dummy && yarn install --no-progress --no-emoji
4860
- name: Install Ruby Gems for package
4961
run: bundle check --path=vendor/bundle || bundle _2.5.9_ install --path=vendor/bundle --jobs=4 --retry=3
5062
- name: Lint Ruby
5163
run: bundle exec rubocop
5264
- name: Install Node modules with Yarn for dummy app
5365
run: cd spec/dummy && yarn install --ignore-scripts --no-progress --no-emoji
66+
- name: Save dummy app ruby gems to cache
67+
uses: actions/cache@v4
68+
with:
69+
path: spec/dummy/vendor/bundle
70+
key: dummy-app-gem-cache-${{ hashFiles('react_on_rails.gemspec') }}-${{ hashFiles('Gemfile.development_dependencies') }}-oldest
5471
- name: Install Ruby Gems for dummy app
5572
run: |
5673
cd spec/dummy

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Changes since the last non-beta release.
2121
#### Fixed
2222
- Fix obscure errors by introducing FULL_TEXT_ERRORS [PR 1695](https://github.com/shakacode/react_on_rails/pull/1695) by [Romex91](https://github.com/Romex91).
2323
- Disable `esModuleInterop` to increase interoperability [PR 1699](https://github.com/shakacode/react_on_rails/pull/1699) by [alexeyr-ci](https://github.com/alexeyr-ci).
24+
- Resolved 14.1.1 incompatibility with eslint & made sure that spec/dummy is linted by eslint. [PR 1693](https://github.com/shakacode/react_on_rails/pull/1693) by [judahmeek](https://github.com/judahmeek).
2425

2526
#### Changed
2627
- More up-to-date TS config [PR 1700](https://github.com/shakacode/react_on_rails/pull/1700) by [alexeyr-ci](https://github.com/alexeyr-ci).

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "react-on-rails",
33
"version": "14.1.1",
44
"description": "react-on-rails JavaScript for react_on_rails Ruby gem",
5+
"main": "node_package/lib/ReactOnRails.js",
56
"exports": {
67
".": {
78
"node": "./node_package/lib/ReactOnRails.node.js",
@@ -27,6 +28,7 @@
2728
"eslint": "^7.32.0",
2829
"eslint-config-prettier": "^7.0.0",
2930
"eslint-config-shakacode": "^16.0.1",
31+
"eslint-import-resolver-alias": "^1.1.2",
3032
"eslint-plugin-import": "^2.29.1",
3133
"eslint-plugin-jsx-a11y": "^6.8.0",
3234
"eslint-plugin-prettier": "^3.4.1",
@@ -43,8 +45,7 @@
4345
"ts-jest": "^29.2.5",
4446
"typescript": "^5.6.2"
4547
},
46-
"dependencies": {
47-
},
48+
"dependencies": {},
4849
"peerDependencies": {
4950
"react": ">= 16",
5051
"react-dom": ">= 16"

spec/dummy/app/views/shared/_header.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,8 @@
104104
<li>
105105
<%= link_to "Incorrectly wrapping a pure component in a function", pure_component_wrapped_in_function_path %>
106106
</li>
107+
<li>
108+
<%= link_to "TurboStream Demo", turbo_frame_tag_hello_world_path %>
109+
</li>
107110
</ul>
108111
<hr/>

spec/dummy/babel.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
module.exports = function (api) {
2-
const defaultConfigFunc = require('shakapacker/package/babel/preset.js');
1+
const defaultConfigFunc = require('shakapacker/package/babel/preset');
2+
3+
module.exports = function createBabelConfig(api) {
34
const resultConfig = defaultConfigFunc(api);
45
const isProductionEnv = api.env('production');
56
const isDevelopmentEnv = api.env('development');

spec/dummy/client/.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

spec/dummy/client/.eslintrc

Lines changed: 0 additions & 12 deletions
This file was deleted.

spec/dummy/client/app/components/RouterLayout.jsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import PropTypes from 'prop-types';
21
import React from 'react';
32
import { Link, Route, Switch } from 'react-router-dom';
43
import RouterFirstPage from './RouterFirstPage';
54
import RouterSecondPage from './RouterSecondPage';
65

7-
const RouterLayout = ({ children }) => (
6+
const RouterLayout = () => (
87
<div className="container">
98
<h1>React Router is working!</h1>
109
<p>
@@ -29,8 +28,4 @@ const RouterLayout = ({ children }) => (
2928
</div>
3029
);
3130

32-
RouterLayout.propTypes = {
33-
children: PropTypes.object,
34-
};
35-
3631
export default RouterLayout;

0 commit comments

Comments
 (0)