Use CircleCI version 2.1 at the top of your .circleci/config.yml file.
1
version: 2.1
Add the orbs
stanza below your version, invoking the orb:
1
2
orbs:
eslint: arrai/eslint@8.1.0
Use eslint
elements in your existing workflows and jobs.
Opt-in to use of uncertified orbs on your organization’s Security settings page.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
wd | The working directory for this job. | No | ~/project | string |
files | Files/Directories to lint. | No | lib/** | string |
executor | The executor to use for the job. | No | lts | executor |
resource_class | The resource class to use for the job. | No | small | enum |
setup | Any additional setup steps. | No | [] | steps |
config | Any additional configuration steps. | No | [] | steps |
create_badges | Generate badges. | No | true | boolean |
npm_version | NPM version to use | No | latest | string |
npm_install | Run npm install prior to lintint | No | true | boolean |
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
wd | The working directory for this job. | No | ~/project | string |
files | Files/Directories to lint. | No | lib/** | string |
executor | The executor to use for the job. | No | lts | executor |
resource_class | The resource class to use for the job. | No | small | enum |
setup | Any additional setup steps. | No | [] | steps |
config | Any additional configuration steps. | No | [] | steps |
create_badges | Generate badges. | No | true | boolean |
npm_version | NPM version to use | No | latest | string |
npm_install | Run npm install prior to lintint | No | true | boolean |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/ja/orbs/licensing
version: 2.1
orbs:
utils: arrai/utils@1.18.0
aliases:
common_parameters: &common_parameters
wd:
description: "The working directory for this job."
type: string
default: ~/project
files:
description: "Files/Directories to lint."
type: string
default: lib/**
executor:
description: "The executor to use for the job."
type: executor
default: lts
resource_class:
description: "The resource class to use for the job."
type: enum
enum: [small, medium, medium+, large, xlarge, 2xlarge, 2xlarge+]
default: small
setup:
description: "Any additional setup steps."
type: steps
default: []
config:
description: "Any additional configuration steps."
type: steps
default: []
create_badges:
description: "Generate badges."
type: boolean
default: true
npm_version:
description: "NPM version to use"
type: string
default: "latest"
npm_install:
description: "Run npm install prior to lintint"
type: boolean
default: true
common_steps: &common_steps
- checkout
- steps: <<parameters.setup>>
- utils/upgrade_npm:
version: <<parameters.npm_version>>
- utils/add_npm_config
- steps: <<parameters.config>>
- when:
condition: <<parameters.npm_install>>
steps:
- run:
name: Run npm install
command: |
cd <<parameters.wd>>
npm install --include dev
- run:
name: Run eslint
command: |
cd <<parameters.wd>>
npx -y eslint --color <<parameters.files>> | tee ~/lint
- when:
condition: <<parameters.create_badges>>
steps:
- utils/add_ssh_config
- utils/make_status_shield:
when: on_fail
status: errors
color: red
logo: eslint
- run:
name: Check if we had any warnings
when: always
command: test ! -s ~/lint
- when:
condition: <<parameters.create_badges>>
steps:
- utils/make_status_shield:
when: always
status: warnings
color: orange
logo: eslint
preserve: true
- utils/make_status_shield:
when: on_success
status: passed
color: brightgreen
logo: eslint
- utils/rsync_file:
when: always
file: ~/status.svg
remote_file: $CIRCLE_BRANCH/$CIRCLE_JOB.svg
host: docs
jobs:
eslint:
parameters:
<<: *common_parameters
executor: <<parameters.executor>>
resource_class: <<parameters.resource_class>>
circleci_ip_ranges: false
steps: *common_steps
eslint_fixed_ip:
parameters:
<<: *common_parameters
executor: <<parameters.executor>>
resource_class: <<parameters.resource_class>>
circleci_ip_ranges: true
steps: *common_steps
executors:
lts:
environment:
LANG: en_US.UTF-8
docker:
- image: cimg/node:lts
current:
environment:
LANG: en_US.UTF-8
docker:
- image: cimg/node:current