Skip to content

Commit

Permalink
update eslint. lint.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonschlinkert committed May 21, 2024
1 parent ba4afe8 commit 6327885
Show file tree
Hide file tree
Showing 18 changed files with 153 additions and 49 deletions.
58 changes: 58 additions & 0 deletions .github/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Contributing to fill-range

First and foremost, thank you! We appreciate that you want to contribute to fill-range, your time is valuable, and your contributions mean a lot to us.

**What does "contributing" mean?**

Creating an issue is the simplest form of contributing to a project. But there are many ways to contribute, including the following:

- Updating or correcting documentation
- Feature requests
- Bug reports

If you'd like to learn more about contributing in general, the [Guide to Idiomatic Contributing](https://github.com/jonschlinkert/idiomatic-contributing) has a lot of useful information.

**Showing support for fill-range**

Please keep in mind that open source software is built by people like you, who spend their free time creating things the rest the community can use.

Don't have time to contribute? No worries, here are some other ways to show your support for fill-range:

- star the [project](https://github.com/jonschlinkert/fill-range)
- tweet your support for fill-range

## Issues

### Before creating an issue

Please try to determine if the issue is caused by an underlying library, and if so, create the issue there. Sometimes this is difficult to know. We only ask that you attempt to give a reasonable attempt to find out. Oftentimes the readme will have advice about where to go to create issues.

Try to follow these guidelines

- **Investigate the issue**:
- **Check the readme** - oftentimes you will find notes about creating issues, and where to go depending on the type of issue.
- Create the issue in the appropriate repository.

### Creating an issue

Please be as descriptive as possible when creating an issue. Give us the information we need to successfully answer your question or address your issue by answering the following in your issue:

- **version**: please note the version of fill-range are you using
- **extensions, plugins, helpers, etc** (if applicable): please list any extensions you're using
- **error messages**: please paste any error messages into the issue, or a [gist](https://gist.github.com/)

## Above and beyond

Here are some tips for creating idiomatic issues. Taking just a little bit extra time will make your issue easier to read, easier to resolve, more likely to be found by others who have the same or similar issue in the future.

- read the [Guide to Idiomatic Contributing](https://github.com/jonschlinkert/idiomatic-contributing)
- take some time to learn basic markdown. This [markdown cheatsheet](https://gist.github.com/jonschlinkert/5854601) is super helpful, as is the GitHub guide to [basic markdown](https://help.github.com/articles/markdown-basics/).
- Learn about [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown/). And if you want to really go above and beyond, read [mastering markdown](https://guides.github.com/features/mastering-markdown/).
- use backticks to wrap code. This ensures that code will retain its format, making it much more readable to others
- use syntax highlighting by adding the correct language name after the first "code fence"


[node-glob]: https://github.com/isaacs/node-glob
[picomatch]: https://github.com/jonschlinkert/picomatch
[micromatch]: https://github.com/jonschlinkert/micromatch
[so]: http://stackoverflow.com/questions/tagged/fill-range
28 changes: 28 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "CodeQL"

on:
push:
pull_request:
schedule:
- cron: "0 0 * * 0"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: "javascript"

- name: Autobuild
uses: github/codeql-action/autobuild@v1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
41 changes: 41 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI
on:
- push
- pull_request

env:
CI: true
FORCE_COLOR: 2

jobs:
run:
name: Node.js ${{ matrix.node }} @ ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
node: [8, 10, 12, 14, 16, 18, 20, 22]
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- name: Clone repository
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- name: Install npm dependencies
run: npm install

- name: Run tests
run: npm run test:ci

- name: Run Coveralls
# `master` should be a tag but they don't have one
uses: coverallsapp/github-action@master
if: startsWith(matrix.os, 'ubuntu') && matrix.node == 14
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ vendor
temp
tmp
TODO.md
package-lock.json
package-lock.json
*.code-*
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion bench/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const fill70 = require('..');
*/

const cycle = (e, newline) => {
process.stdout.write(`\u001b[G ${e.target}${newline ? `\n` : ''}`);
process.stdout.write(`\u001b[G ${e.target}${newline ? '\n' : ''}`);
};

const bench = (name, options) => {
Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,19 @@
"node": ">=8"
},
"scripts": {
"test": "mocha"
"lint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives --ignore-path .gitignore .",
"mocha": "mocha --reporter dot",
"test": "npm run lint && npm run mocha",
"test:ci": "npm run test:cover",
"test:cover": "nyc npm run mocha"
},
"dependencies": {
"to-regex-range": "^5.0.1"
},
"devDependencies": {
"gulp-format-md": "^2.0.0",
"mocha": "^6.1.1"
"mocha": "^6.1.1",
"nyc": "^15.1.0"
},
"keywords": [
"alpha",
Expand Down
2 changes: 0 additions & 2 deletions test/custom-expand.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

require('mocha');
const assert = require('assert');
const exact = require('./support/exact');
const fill = require('..');

Expand Down
1 change: 0 additions & 1 deletion test/errors.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

require('mocha');
const assert = require('assert');
const fill = require('..');

Expand Down
1 change: 0 additions & 1 deletion test/invalid.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

require('mocha');
const assert = require('assert');
const fill = require('..');

Expand Down
2 changes: 0 additions & 2 deletions test/matching.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict';

require('mocha');
const assert = require('assert');
const exact = require('./support/exact');
const fill = require('..');

const toRegex = (...args) => new RegExp(`^(${fill(...args)})$`);
Expand Down
2 changes: 0 additions & 2 deletions test/options.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

require('mocha');
const util = require('util');
const assert = require('assert');
const exact = require('./support/exact');
const fill = require('..');
Expand Down
20 changes: 9 additions & 11 deletions test/padding.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

require('mocha');
const util = require('util');
const assert = require('assert').strict;
const fill = require('..');

Expand All @@ -12,8 +10,8 @@ describe('padding: numbers', () => {
assert.deepEqual(fill('1', '03'), ['01', '02', '03']);
assert.deepEqual(fill('0001', '0003'), ['0001', '0002', '0003']);
assert.deepEqual(fill('-10', '00'), ['-10', '-09', '-08', '-07', '-06', '-05', '-04', '-03', '-02', '-01', '000']);
assert.deepEqual(fill('05', '010'), ['005','006','007','008','009','010']);
assert.deepEqual(fill('05', '100'), ['005','006','007','008','009','010','011','012','013','014','015','016','017','018','019','020','021','022','023','024','025','026','027','028','029','030','031','032','033','034','035','036','037','038','039','040','041','042','043','044','045','046','047','048','049','050','051','052','053','054','055','056','057','058','059','060','061','062','063','064','065','066','067','068','069','070','071','072','073','074','075','076','077','078','079','080','081','082','083','084','085','086','087','088','089','090','091','092','093','094','095','096','097','098','099','100']);
assert.deepEqual(fill('05', '010'), ['005', '006', '007', '008', '009', '010']);
assert.deepEqual(fill('05', '100'), ['005', '006', '007', '008', '009', '010', '011', '012', '013', '014', '015', '016', '017', '018', '019', '020', '021', '022', '023', '024', '025', '026', '027', '028', '029', '030', '031', '032', '033', '034', '035', '036', '037', '038', '039', '040', '041', '042', '043', '044', '045', '046', '047', '048', '049', '050', '051', '052', '053', '054', '055', '056', '057', '058', '059', '060', '061', '062', '063', '064', '065', '066', '067', '068', '069', '070', '071', '072', '073', '074', '075', '076', '077', '078', '079', '080', '081', '082', '083', '084', '085', '086', '087', '088', '089', '090', '091', '092', '093', '094', '095', '096', '097', '098', '099', '100']);
});

it('should pad decremented numbers:', () => {
Expand Down Expand Up @@ -46,13 +44,13 @@ describe('padding: numbers', () => {
});

it('should pad stepped numbers', () => {
assert.deepEqual(fill('1', '05', '3'), ['01','04']);
assert.deepEqual(fill('1', '5', '03'), ['01','04']);
assert.deepEqual(fill('1', '5', '0003'), ['0001','0004']);
assert.deepEqual(fill('1', '005', '3'), ['001','004']);
assert.deepEqual(fill('00', '1000', '200'), ['0000','0200', '0400', '0600', '0800', '1000']);
assert.deepEqual(fill('0', '01000', '200'), ['00000','00200', '00400', '00600', '00800', '01000']);
assert.deepEqual(fill('001', '5', '3'), ['001','004']);
assert.deepEqual(fill('1', '05', '3'), ['01', '04']);
assert.deepEqual(fill('1', '5', '03'), ['01', '04']);
assert.deepEqual(fill('1', '5', '0003'), ['0001', '0004']);
assert.deepEqual(fill('1', '005', '3'), ['001', '004']);
assert.deepEqual(fill('00', '1000', '200'), ['0000', '0200', '0400', '0600', '0800', '1000']);
assert.deepEqual(fill('0', '01000', '200'), ['00000', '00200', '00400', '00600', '00800', '01000']);
assert.deepEqual(fill('001', '5', '3'), ['001', '004']);
assert.deepEqual(fill('02', '10', 2), ['02', '04', '06', '08', '10']);
assert.deepEqual(fill('002', '10', 2), ['002', '004', '006', '008', '010']);
assert.deepEqual(fill('002', '010', 2), ['002', '004', '006', '008', '010']);
Expand Down
6 changes: 2 additions & 4 deletions test/ranges.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

require('mocha');
const assert = require('assert');
const exact = require('./support/exact');
const fill = require('..');

Expand All @@ -17,7 +15,7 @@ describe('ranges', () => {

it('should decrement alphabetical ranges', () => {
exact(fill('E', 'A'), ['E', 'D', 'C', 'B', 'A']);
exact(fill('a', 'C'), ['a','`','_','^',']',"\\",'[','Z','Y','X','W','V','U','T','S','R','Q','P','O','N','M','L','K','J','I','H','G','F','E','D','C']);
exact(fill('a', 'C'), ['a', '`', '_', '^', ']', '\\', '[', 'Z', 'Y', 'X', 'W', 'V', 'U', 'T', 'S', 'R', 'Q', 'P', 'O', 'N', 'M', 'L', 'K', 'J', 'I', 'H', 'G', 'F', 'E', 'D', 'C']);
exact(fill('z', 'm'), ['z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm']);
});
});
Expand Down Expand Up @@ -49,7 +47,7 @@ describe('ranges', () => {

it('should decrement alphabetical ranges', () => {
exact(fill('E', 'A'), ['E', 'D', 'C', 'B', 'A']);
exact(fill('a', 'C'), ['a','`','_','^',']',"\\",'[','Z','Y','X','W','V','U','T','S','R','Q','P','O','N','M','L','K','J','I','H','G','F','E','D','C']);
exact(fill('a', 'C'), ['a', '`', '_', '^', ']', '\\', '[', 'Z', 'Y', 'X', 'W', 'V', 'U', 'T', 'S', 'R', 'Q', 'P', 'O', 'N', 'M', 'L', 'K', 'J', 'I', 'H', 'G', 'F', 'E', 'D', 'C']);
exact(fill('z', 'm'), ['z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm']);
});
});
Expand Down
4 changes: 1 addition & 3 deletions test/special.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

require('mocha');
const assert = require('assert');
const exact = require('./support/exact');
const fill = require('..');

Expand All @@ -23,7 +21,7 @@ describe('special cases', () => {
});

it('should adjust padding for negative numbers:', () => {
exact(fill('-01', '5'), ['-01','000','001','002','003','004','005']);
exact(fill('-01', '5'), ['-01', '000', '001', '002', '003', '004', '005']);
});
});
});
8 changes: 3 additions & 5 deletions test/steps.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

require('mocha');
const assert = require('assert');
const exact = require('./support/exact');
const fill = require('..');

Expand All @@ -10,7 +8,7 @@ describe('steps', () => {
it('should increment ranges using the given step', () => {
exact(fill('1', '10', '1'), ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']);
exact(fill('1', '10', '2'), ['1', '3', '5', '7', '9']);
exact(fill('0', '1000', '200'), ['0','200', '400', '600', '800', '1000']);
exact(fill('0', '1000', '200'), ['0', '200', '400', '600', '800', '1000']);
exact(fill('1', '10', 2), ['1', '3', '5', '7', '9']);
exact(fill('1', '20', '2'), ['1', '3', '5', '7', '9', '11', '13', '15', '17', '19']);
exact(fill('1', '20', '20'), ['1']);
Expand Down Expand Up @@ -65,15 +63,15 @@ describe('steps', () => {
describe('steps: letters', () => {
it('should use increments with alphabetical ranges', () => {
exact(fill('z', 'a', -2), ['z', 'x', 'v', 't', 'r', 'p', 'n', 'l', 'j', 'h', 'f', 'd', 'b']);
exact(fill('a', 'e', 2), ['a','c', 'e']);
exact(fill('a', 'e', 2), ['a', 'c', 'e']);
exact(fill('E', 'A', 2), ['E', 'C', 'A']);
});
});

describe('options: step', () => {
it('should use the step defined on the options:', () => {
let options = { step: 2 };
exact(fill('a', 'e', options), ['a','c', 'e']);
exact(fill('a', 'e', options), ['a', 'c', 'e']);
exact(fill('E', 'A', options), ['E', 'C', 'A']);
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/support/exact.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const util = require('util');
const assert = require('assert');
const util = require('util');

module.exports = (actual, expected) => {
assert(Array.isArray(actual));
Expand Down
2 changes: 0 additions & 2 deletions test/verify-matches.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@

'use strict';

require('mocha');
const assert = require('assert');
const expand = require('./support/expand');
const exact = require('./support/exact');
const fill = require('..');
let count = 0;

Expand Down

0 comments on commit 6327885

Please sign in to comment.