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

Update Node.js requirements, ESLint, ruleset names; drop Make #4

Merged
merged 32 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
711d8e8
Use canonical repo name
danyalaytekin Oct 7, 2023
89684fe
Remove optional field package.keywords because it's empty
danyalaytekin Oct 7, 2023
aa21529
Use shorthand for package.repository
danyalaytekin Oct 7, 2023
a47a904
Upgrade Node support to a version currently in LTS: 18, 20
danyalaytekin Oct 7, 2023
7c15c47
Update copyright date to 2023 from 2020
danyalaytekin Oct 7, 2023
f07a073
Remove unused Twitter definition
danyalaytekin Oct 7, 2023
dd0ab7e
Space sections consistently
danyalaytekin Oct 7, 2023
3a1211f
Fix filename in script used to generate .eslintrc.js
danyalaytekin Oct 7, 2023
d9206d1
Rename legacy to es2009 and drop es5
danyalaytekin Oct 7, 2023
c1e3a4e
Drop alias es6 for es2015
danyalaytekin Oct 7, 2023
8c65367
Recommend latest provided config es2017 for a new project instead of …
danyalaytekin Oct 7, 2023
e36dec3
Update guidance
danyalaytekin Oct 7, 2023
23cc785
Add MIGRATION.md and 'Migrating to 3 from 2'
danyalaytekin Oct 7, 2023
3967392
Secede respectfully from archived homeland after 1000 gun salute
danyalaytekin Oct 7, 2023
97c4c0d
Trim sections unused by this repo
danyalaytekin Oct 7, 2023
f6b2bcd
Export es2017
danyalaytekin Oct 7, 2023
82e47fe
Unignore and commit lockfile
danyalaytekin Oct 7, 2023
7654fa2
Replace 'make verify' with 'npm test'
danyalaytekin Oct 7, 2023
5cf6455
Run on push to main as well as master in preparation for renaming def…
danyalaytekin Oct 7, 2023
9831867
Run workflow on pull_request targetting any branch
danyalaytekin Oct 7, 2023
aa4f14e
Remove comments and names which are well-described by adjacent code
danyalaytekin Oct 7, 2023
90ceeba
Use latest versions of native actions checkout (4) and setup-node (3)
danyalaytekin Oct 7, 2023
9339acc
Upgrade ESLint to latest (^8.51) from ^7.27
danyalaytekin Oct 7, 2023
415b59f
Use 'npm ci' instead of 'npm install'
danyalaytekin Oct 7, 2023
8f2a9d3
Reverse reference to formal 'Shareable Config' until confident it mee…
danyalaytekin Oct 8, 2023
c705a4c
Set package.main to `.eslintrc.js`
danyalaytekin Oct 8, 2023
04a1c42
Phrase deletion of es5 and es6 less ambiguously
danyalaytekin Oct 8, 2023
8fe4010
Fix URL of npm badge
danyalaytekin Oct 8, 2023
7c03737
Fix typo and remove assumption
danyalaytekin Oct 8, 2023
72c99db
Fix typo in package.main
danyalaytekin Oct 8, 2023
4e6af4b
Fix typo when discussing other options for `es2017`
danyalaytekin Oct 8, 2023
d2dee2a
Remove double use of word 'files'
danyalaytekin Oct 8, 2023
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 .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
'use strict';

module.exports = require('./eslint/es6');
module.exports = require('./eslint/es2017');
28 changes: 8 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests.
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Build and lint

on:
push:
branches: # Run actions when code is committed to these branches
branches:
- master
- main
pull_request:
branches: # Run actions when a PR is pushed based on one of these branches
- master

jobs:
checkout_and_test:
test:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- node-version: 12.x

node-version: [18, 20]
steps:
- name: Checkout code from ${{ github.repository }}
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Run tests
run: make verify
- run: npm ci
- run: npm test
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
node_modules
npm-debug.log
package-lock.json
11 changes: 11 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Migration guide

Major versions of Pa11y Lint Config can bring API or compatibility changes. This is a guide to help you make the switch when that happens.

## Migrating to 3 from 2

1. Upgrade to Node.js 18 or above.
1. Modifies some names and aliases for rulesets:
1. Drops `es2015`'s alias `es6`
1. Drops `legacy`'s alias `es5`
1. Renames `legacy` to `es2009`
1 change: 0 additions & 1 deletion Makefile

This file was deleted.

125 changes: 0 additions & 125 deletions Makefile.node

This file was deleted.

43 changes: 12 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,43 @@

# Pa11y Lint Config

Linter configurations for Pa11y projects. This module should be used to ensure that the Pa11y coding style is consistent across all of our repositories.
Linter configurations for Pa11y projects. We use these configurations to ensure Pa11y's coding style remains consistent across our repositories.

[![NPM version][shield-npm]][info-npm]
[![Build status][shield-build]][info-build]
[![LGPL-3.0 licensed][shield-license]][info-license]


## Table Of Contents

- [Requirements](#requirements)
- [Usage](#usage)
- [ESLint](#eslint)
- [Contributing](#contributing)
- [License](#license)


## Requirements

This library requires [Node.js] 14+.

This library requires [Node.js] 18 or above.

## Usage

Pa11y Lint Config provides some linter config files which can be included in your project.

### ESLint

To use the [ESLint] config files, first install this module and ESLint, saving them to development dependencies:
To include these config files in your project, first install [ESLint] and this module, saving them to development dependencies. For example, using npm:

```sh
npm install --save-dev eslint pa11y-lint-config
```

Now you should create `.eslintrc.js` and `.eslintignore` files in your project root. The command below provides some defaults which should be enough for most new Pa11y projects:
Now create the files `.eslintrc.js` and `.eslintignore` in your project root. The following command will create both files and populate them with sensible settings for a new Pa11y project:

```sh
printf "coverage\n" > .eslintignore
printf "'use strict';\n\nmodule.exports = require('pa11y-lint-config/eslint/2015');\n" > .eslintrc.js
```

If your project uses ES5 syntax (should mostly be browser or legacy projects), then you'll need to include `eslint/legacy` instead of `eslint/2015`:

```sh
printf "'use strict';\n\nmodule.exports = require('pa11y-lint-config/eslint/legacy');\n" > .eslintrc.js
printf "'use strict';\n\nmodule.exports = require('pa11y-lint-config/eslint/es2017');\n" > .eslintrc.js
```

If your project uses more modern syntax (including `async`/`await`), then you'll need to include `eslint/2017` instead of `eslint/2015`:
Two other standards can replace `es2017` above:

```sh
printf "'use strict';\n\nmodule.exports = require('pa11y-lint-config/eslint/2017');\n" > .eslintrc.js
```

If your project contains a mix of ES6 and ES5 (e.g. Node.js and browser) then you can include different config files in each directory.
1. `es2015`, for an ES2015/ES6 project, forgoing the use of more recent syntax additions such as `async`
1. `es2009`, for an ES2009/ES5 project, such as an older client-side codebase

A project which contains more than one standard, for example ES2017 for the server and ES2015 for the browser, can support each required standard by including a different config file in each relevant subdirectory.

## Contributing

Expand All @@ -65,24 +48,22 @@ If you're ready to contribute some code, clone this repo locally and commit your
Please check that everything works by running the following before opening a <abbr title="pull request">PR</abbr>:

```sh
make ci
npm test
```


## Licence

Licensed under the [Lesser General Public License (LGPL-3.0)](LICENSE).<br/>
Copyright &copy; 2020, Team Pa11y
Copyright &copy; 2023, Team Pa11y



[eslint]: http://eslint.org/
[issues]: https://github.com/pa11y/pa11y-lint-config/issues
[node.js]: https://nodejs.org/
[twitter]: https://twitter.com/pa11yorg

[info-license]: LICENSE
[info-npm]: https://www.npmjs.com/package/pa11y-ci
[info-npm]: https://www.npmjs.com/package/pa11y-lint-config
[info-build]: https://travis-ci.org/pa11y/pa11y-lint-config
[shield-license]: https://img.shields.io/badge/license-LGPL%203.0-blue.svg
[shield-npm]: https://img.shields.io/npm/v/pa11y-lint-config.svg
Expand Down
File renamed without changes.
4 changes: 0 additions & 4 deletions eslint/es5.js

This file was deleted.

4 changes: 0 additions & 4 deletions eslint/es6.js

This file was deleted.

Loading