Skip to content

Commit

Permalink
Update eslint to work across windows, maxOS, and ubuntu (mldangelo#446)
Browse files Browse the repository at this point in the history
* convert to javascript

* sort keys

* add custom linebreak style rule

* matrix operating system

* dont matrix node version for lint

* attempt to make lint work on 'nix and windows

* use ubuntu latest

* add newline

* matrix build step

* run fewer build steps

* remove custom linebreak style

* revert rule change

* move ignore into eslintrc.js file
  • Loading branch information
mldangelo authored Oct 1, 2023
1 parent 567408c commit 1cf2164
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 42 deletions.
39 changes: 0 additions & 39 deletions .eslintrc

This file was deleted.

44 changes: 44 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const os = require('os');

module.exports = {
env: {
browser: true,
jest: true,
node: true,
},
extends: 'airbnb',
ignorePatterns: [
'node_modules/',
'build/',
],
parser: '@babel/eslint-parser',
plugins: ['react'],
rules: {
'jsx-a11y/anchor-is-valid': ['error', {
aspects: ['noHref', 'invalidHref', 'preferButton'],
components: ['Link'],
specialLink: ['to', 'hrefLeft', 'hrefRight'],
}],
'jsx-a11y/click-events-have-key-events': 0,
'jsx-a11y/href-no-hash': 'off',
'jsx-a11y/no-static-element-interactions': 0,
'linebreak-style': ['error', os.EOL === '\r\n' ? 'windows' : 'unix'],
'no-console': ['error', {
allow: ['warn', 'error', 'info'],
}],
'no-underscore-dangle': 0,
'react/destructuring-assignment': 0,
'react/function-component-definition': [2, { namedComponents: 'arrow-function' }],
'react/jsx-filename-extension': [1, {
extensions: ['.js', '.jsx'],
}],
'react/jsx-no-useless-fragment': 0,
'react/jsx-one-expression-per-line': 0,
'react/jsx-props-no-spreading': 0,
'react/jsx-wrap-multilines': [1, {
assignment: true,
declaration: true,
return: true,
}],
},
};
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
17 changes: 15 additions & 2 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ on:

jobs:
lint:
runs-on: ubuntu-20.04
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
Expand All @@ -25,11 +28,21 @@ jobs:
run: npm run lint

build:
runs-on: ubuntu-20.04
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
os: [ubuntu-20.04, windows-latest, macos-latest]
exclude:
- os: windows-latest
node-version: 16.x
- os: windows-latest
node-version: 18.x
- os: macos-latest
node-version: 16.x
- os: macos-latest
node-version: 18.x
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"scripts": {
"analyze": "npm run build && source-map-explorer build/static/js/*.chunk.js",
"build": "rimraf ./build && react-scripts build",
"lint": "eslint $(git ls-files '*.js')",
"lint": "eslint \"**/*.js\"",
"predeploy": "npm run build && react-snap",
"start": "react-scripts start",
"test": "npx jest"
Expand Down

0 comments on commit 1cf2164

Please sign in to comment.