Skip to content

Commit

Permalink
Merge pull request #401 from openaddresses/fix-eslint
Browse files Browse the repository at this point in the history
Try fixing eslint errors
  • Loading branch information
iandees authored Nov 17, 2024
2 parents 3d0a3a9 + 9bdd8ca commit d0fd4f3
Show file tree
Hide file tree
Showing 15 changed files with 92 additions and 90 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ecr_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ jobs:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Docker Build API
run: docker build -t api api/

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
uses: aws-actions/amazon-ecr-login@v2

- name: Docker Tag API
run: docker tag api ${{secrets.AWS_ACCOUNT_ID}}.dkr.ecr.us-east-1.amazonaws.com/batch:api-${{ github.event.pull_request.head.sha || github.sha }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ecr_task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
if: github.event.pull_request.draft == false
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}

Expand All @@ -33,7 +33,7 @@ jobs:

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
uses: aws-actions/amazon-ecr-login@v2

- name: Docker Build Task
run: docker build -t task task/
Expand Down
64 changes: 31 additions & 33 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
import js from "@eslint/js";
import nodePlugin from "eslint-plugin-n";
import nodePlugin from 'eslint-plugin-n';

export default [
js.configs.recommended,
nodePlugin.configs["flat/recommended-module"],
nodePlugin.configs['flat/recommended-module'],
{
"rules": {
"no-console": 0,
"arrow-parens": [ "error", "always" ],
"no-var": "error",
"prefer-const": "error",
"array-bracket-spacing": [ "error", "never" ],
"comma-dangle": [ "error", "never" ],
"computed-property-spacing": [ "error", "never" ],
"eol-last": "error",
"eqeqeq": [ "error", "smart" ],
"indent": [ "error", 4, { "SwitchCase": 1 } ],
"no-confusing-arrow": [ "error", { "allowParens": false } ],
"no-extend-native": "error",
"no-mixed-spaces-and-tabs": "error",
"func-call-spacing": [ "error", "never" ],
"no-trailing-spaces": "error",
"no-unused-vars": "error",
"no-use-before-define": [ "error", "nofunc" ],
"object-curly-spacing": [ "error", "always" ],
"prefer-arrow-callback": "error",
"quotes": [ "error", "single", "avoid-escape" ],
"semi": [ "error", "always" ],
"space-infix-ops": "error",
"spaced-comment": [ "error", "always" ],
"keyword-spacing": [ "error", { "before": true, "after": true } ],
"template-curly-spacing": [ "error", "never" ],
"semi-spacing": "error",
"strict": "error",
'rules': {
'no-console': 0,
'arrow-parens': ['error', 'always'],
'no-var': 'error',
'prefer-const': 'error',
'array-bracket-spacing': ['error', 'never'],
'comma-dangle': ['error', 'never'],
'computed-property-spacing': ['error', 'never'],
'eol-last': 'error',
'eqeqeq': ['error', 'smart'],
'indent': ['error', 4, { 'SwitchCase': 1 }],
'no-confusing-arrow': ['error', { 'allowParens': false }],
'no-extend-native': 'error',
'no-mixed-spaces-and-tabs': 'error',
'func-call-spacing': ['error', 'never'],
'no-trailing-spaces': 'error',
'no-unused-vars': 'error',
'no-use-before-define': ['error', 'nofunc'],
'object-curly-spacing': ['error', 'always'],
'prefer-arrow-callback': 'error',
'quotes': ['error', 'single', 'avoid-escape'],
'semi': ['error', 'always'],
'space-infix-ops': 'error',
'spaced-comment': ['error', 'always'],
'keyword-spacing': ['error', { 'before': true, 'after': true }],
'template-curly-spacing': ['error', 'never'],
'semi-spacing': 'error',
'strict': 'error'
}
}
]
];
3 changes: 3 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"repository": "[email protected]:openaddresses/batch",
"author": "ingalls <[email protected]>",
"private": false,
"engines": {
"node": ">=22.0.0"
},
"scripts": {
"test": "echo 'no tests'",
"lint": "eslint cloudformation/"
Expand Down
2 changes: 1 addition & 1 deletion task/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18-alpine3.17 AS node
FROM node:22-alpine3.19 AS node
FROM 847904970422.dkr.ecr.us-east-1.amazonaws.com/batch-machine:9.3.0

COPY --from=node /usr/lib /usr/lib
Expand Down
8 changes: 3 additions & 5 deletions task/collect.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env node

// Does not need to mark instance
// as protected as it runs on a managed queue
import { interactive } from './lib/pre.js';
Expand Down Expand Up @@ -66,7 +64,7 @@ async function cli() {

tmp = path.resolve(DRIVE, Math.random().toString(36).substring(2, 15));
} catch (err) {
console.error(`ok - could not find ${DRIVE}`);
console.error(`ok - could not find ${DRIVE}: ${err}`);
}

fs.mkdirSync(tmp);
Expand All @@ -87,7 +85,7 @@ async function cli() {
}
} catch (err) {
console.error(err);
process.exit(1);
throw err;
}
}

Expand Down Expand Up @@ -171,7 +169,7 @@ async function get_source(oa, tmp, data, stats) {
Bucket: process.env.Bucket,
Key: `${process.env.StackName}/job/${data.job}/source.geojson.gz`
}))).Body,
Unzip(),
new Unzip(),
split(),
new Transform({
objectMode: true,
Expand Down
64 changes: 31 additions & 33 deletions task/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
import js from "@eslint/js";
import nodePlugin from "eslint-plugin-n";
import nodePlugin from 'eslint-plugin-n';

export default [
js.configs.recommended,
nodePlugin.configs["flat/recommended-module"],
nodePlugin.configs['flat/recommended-module'],
{
"rules": {
"no-console": 0,
"arrow-parens": [ "error", "always" ],
"no-var": "error",
"prefer-const": "error",
"array-bracket-spacing": [ "error", "never" ],
"comma-dangle": [ "error", "never" ],
"computed-property-spacing": [ "error", "never" ],
"eol-last": "error",
"eqeqeq": [ "error", "smart" ],
"indent": [ "error", 4, { "SwitchCase": 1 } ],
"no-confusing-arrow": [ "error", { "allowParens": false } ],
"no-extend-native": "error",
"no-mixed-spaces-and-tabs": "error",
"func-call-spacing": [ "error", "never" ],
"no-trailing-spaces": "error",
"no-unused-vars": "error",
"no-use-before-define": [ "error", "nofunc" ],
"object-curly-spacing": [ "error", "always" ],
"prefer-arrow-callback": "error",
"quotes": [ "error", "single", "avoid-escape" ],
"semi": [ "error", "always" ],
"space-infix-ops": "error",
"spaced-comment": [ "error", "always" ],
"keyword-spacing": [ "error", { "before": true, "after": true } ],
"template-curly-spacing": [ "error", "never" ],
"semi-spacing": "error",
"strict": "error",
'rules': {
'no-console': 0,
'arrow-parens': ['error', 'always'],
'no-var': 'error',
'prefer-const': 'error',
'array-bracket-spacing': ['error', 'never'],
'comma-dangle': ['error', 'never'],
'computed-property-spacing': ['error', 'never'],
'eol-last': 'error',
'eqeqeq': ['error', 'smart'],
'indent': ['error', 4, { 'SwitchCase': 1 }],
'no-confusing-arrow': ['error', { 'allowParens': false }],
'no-extend-native': 'error',
'no-mixed-spaces-and-tabs': 'error',
'func-call-spacing': ['error', 'never'],
'no-trailing-spaces': 'error',
'no-unused-vars': 'error',
'no-use-before-define': ['error', 'nofunc'],
'object-curly-spacing': ['error', 'always'],
'prefer-arrow-callback': 'error',
'quotes': ['error', 'single', 'avoid-escape'],
'semi': ['error', 'always'],
'space-infix-ops': 'error',
'spaced-comment': ['error', 'always'],
'keyword-spacing': ['error', { 'before': true, 'after': true }],
'template-curly-spacing': ['error', 'never'],
'semi-spacing': 'error',
'strict': 'error'
}
}
]
];
4 changes: 2 additions & 2 deletions task/export.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env node
import { interactive } from './lib/pre.js';

import Meta from './lib/meta.js';
Expand Down Expand Up @@ -151,6 +150,7 @@ async function cli() {
});
} finally {
await meta.protection(false);
// eslint-disable-next-line n/no-process-exit
process.exit(1);
}
}
Expand Down Expand Up @@ -247,7 +247,7 @@ async function get_source(tmp, jobid) {
Bucket: process.env.Bucket,
Key: `${process.env.StackName}/job/${jobid}/source.geojson.gz`
}))).Body,
Unzip(),
new Unzip(),
fs.createWriteStream(path.resolve(tmp, 'source.geojson'))
);

Expand Down
6 changes: 2 additions & 4 deletions task/fabric.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env node

// Does not need to mark instance
// as protected as it runs on a managed queue
import { interactive } from './lib/pre.js';
Expand Down Expand Up @@ -183,7 +181,7 @@ async function cli() {
} catch (err) {
await meta.protection(false);
console.error(err);
process.exit();
throw err;
}
}

Expand All @@ -195,7 +193,7 @@ async function get_source(out, data) {
Bucket: process.env.Bucket,
Key: `${process.env.StackName}/job/${data.job}/source.geojson.gz`
}))).Body,
Unzip(),
new Unzip(),
fs.createWriteStream(path.resolve(DRIVE, `${data.layer}.geojson`), { flags: 'a' })
);
}
2 changes: 1 addition & 1 deletion task/lib/tippecanoe.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class Tippecanoe {
CP.execSync('tippecanoe --version 2>&1');
CP.execSync('which tile-join');
} catch (err) {
throw new Error('tippecanoe not installed');
throw new Error('tippecanoe not installed', err);
}
}

Expand Down
3 changes: 3 additions & 0 deletions task/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions task/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"main": "index.js",
"license": "MIT",
"private": true,
"engines": {
"node": ">=22.0.0"
},
"scripts": {
"test": "tape test/**.test.js",
"lint": "eslint *.js lib/ test/"
Expand Down
4 changes: 1 addition & 3 deletions task/sources.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env node

import { interactive } from './lib/pre.js';

import Meta from './lib/meta.js';
Expand Down Expand Up @@ -93,7 +91,7 @@ async function cli() {
} catch (err) {
console.error(err);
await meta.protection(false);
process.exit(1);
throw err;
}
}

Expand Down
4 changes: 2 additions & 2 deletions task/task.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env node
import { interactive } from './lib/pre.js';

import Job from './lib/job.js';
Expand Down Expand Up @@ -55,7 +54,7 @@ async function cli() {

flow(job).catch((err) => {
console.error(err);
process.exit(1);
throw err;
});
}

Expand Down Expand Up @@ -134,6 +133,7 @@ async function flow(job) {
console.error(err);
} finally {
await meta.protection(false);
// eslint-disable-next-line n/no-process-exit
process.exit(1);
}
}
Expand Down

0 comments on commit d0fd4f3

Please sign in to comment.