Skip to content

Commit

Permalink
chore: upgrade to eslint@v9 (#1002)
Browse files Browse the repository at this point in the history
  • Loading branch information
redonkulus authored Oct 7, 2024
1 parent 310096e commit 45aae1b
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 54 deletions.
12 changes: 0 additions & 12 deletions .eslintignore

This file was deleted.

36 changes: 0 additions & 36 deletions .eslintrc.js

This file was deleted.

60 changes: 60 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import js from '@eslint/js';
import globals from 'globals';
import reactPlugin from 'eslint-plugin-react';

export default [
js.configs.recommended,
reactPlugin.configs.flat.recommended,
{
ignores: [
'.idea/',
'*-debug.log',
'artifacts/',
'build/',
'components-dist/',
'configs/atomizer.json',
'dist/',
'node_modules/',
'npm-*.log',
'protractor-batch-artifacts/',
'results/',
'tests/functional/bootstrap.js',
],
},
{
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
languageOptions: {
...reactPlugin.configs.flat.recommended.languageOptions,
ecmaVersion: 2024,
globals: {
...globals.browser,
...globals.jest,
...globals.mocha,
...globals.node,
...globals.protractor,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
sourceType: 'module',
},
},
plugins: {
react: reactPlugin,
},
rules: {
indent: [2, 4, { SwitchCase: 1 }],
quotes: [0, 'single'],
'dot-notation': [2, { allowKeywords: false }],
'no-console': 0,
'no-prototype-builtins': 0,
'no-unexpected-multiline': 0,
},
settings: {
react: {
version: 'detect',
},
},
},
];
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"func": "wdio",
"func:build": "rm -rf tests/functional/dist && npm run build:babel && npm run build:css && npm run build:copy && npm run build:webpack",
"func:local": "npm run func:build && wdio",
"lint": "eslint --ext .js,.jsx . --fix && npm run format:check",
"lint": "eslint . --fix && npm run format:check",
"prepublish": "npm run build",
"prestart": "npm run prefunc",
"test": "jest --coverage tests/unit"
Expand Down Expand Up @@ -69,9 +69,10 @@
"babel-jest": "^29.0.0",
"babel-plugin-add-module-exports": "^1.0.4",
"chromedriver": "^129.0.0",
"eslint": "^8.0.0",
"eslint-plugin-react": "^7.19.0",
"eslint": "^9.0.0",
"eslint-plugin-react": "^7.37.1",
"gh-pages": "^6.0.0",
"globals": "^15.10.0",
"jest": "^29.0.0",
"jest-environment-jsdom": "^29.0.0",
"mocha": "^10.0.0",
Expand Down
2 changes: 2 additions & 0 deletions src/Sticky.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ class Sticky extends Component {
// Commentting out "break" is on purpose, because there is a chance to transit to FIXED
// from ORIGINAL when calling window.scrollTo().
// break;
/* eslint-disable-next-line no-fallthrough */
case STATUS_RELEASED:
// If "top" and "bottom" are inbetween stickyTop and stickyBottom, then Sticky is in
// RELEASE status. Otherwise, it changes to FIXED status, and its bottom sticks to
Expand Down Expand Up @@ -492,6 +493,7 @@ Sticky.defaultProps = {
* Could be a selector representing a node whose bottom should serve as the bottom boudary.
*/
Sticky.propTypes = {
children: PropTypes.elementType,
enabled: PropTypes.bool,
top: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
bottomBoundary: PropTypes.oneOfType([
Expand Down
1 change: 1 addition & 0 deletions tests/functional/sticky-functional.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react/react-in-jsx-scope,react/prop-types */
const classNames = require('classnames');
const Sticky = require('../../../dist/cjs/Sticky');

Expand Down
1 change: 1 addition & 0 deletions tests/unit/Sticky.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ describe('Sticky', () => {
render() {
return (
<Sticky
/* eslint-disable-next-line react/no-string-refs */
ref="sticky"
bottomBoundary={`#boundary{this.state.boundary}`}
enabled={this.state.enabled}
Expand Down
6 changes: 3 additions & 3 deletions wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ const config = {

if (process.env.CI) {
// Saucelabs configuration
(config.capabilities = [
config.capabilities = [
{
acceptInsecureCerts: true,
browserName: 'chrome',
browserVersion: 'latest',
maxInstances: 5,
platformName: 'Windows 10',
},
]),
(config.key = process.env.SAUCE_ACCESS_KEY);
];
config.key = process.env.SAUCE_ACCESS_KEY;
config.services = [
[
'sauce',
Expand Down

0 comments on commit 45aae1b

Please sign in to comment.