Skip to content

Commit

Permalink
Merge pull request #264 from oddbird/lint
Browse files Browse the repository at this point in the history
Use lts/* and lts/-n for node version; work around Node breaking change.
  • Loading branch information
jgerigmeyer authored Dec 15, 2023
2 parents b2e7b46 + f9a28ed commit 7c0f559
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 27 deletions.
32 changes: 14 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ defaults:

env:
PROTOC_VERSION: 3.x
DEFAULT_NODE_VERSION: 18.x # If changing this, also change jobs.tests.strategy.matrix.node_version

on:
push:
Expand All @@ -19,10 +18,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
node-version: 'lts/*'
check-latest: true

- name: Check out the language repo
Expand All @@ -43,12 +42,12 @@ jobs:
strategy:
matrix:
os: [ubuntu, macos, windows]
node-version: [18.x, 16.x, 14.x] # If changing this, also change env.DEFAULT_NODE_VERSION
node-version: ['lts/*', 'lts/-1', 'lts/-2']
fail-fast: false

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
check-latest: true
Expand All @@ -73,9 +72,6 @@ jobs:
- run: npm run compile
- run: node test/after-compile-test.mjs

# The versions should be kept up-to-date with the latest LTS Node releases.
# They next need to be rotated October 2021. See
# https://github.com/nodejs/Release.
sass_spec:
name: 'JS API Tests | Node ${{ matrix.node_version }} | ${{ matrix.os }}'
runs-on: ${{ matrix.os }}-latest
Expand All @@ -84,19 +80,19 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
node_version: [18]
node_version: ['lts/*']
include:
# Include LTS versions on Ubuntu
- os: ubuntu
node_version: 16
node_version: lts/-1
- os: ubuntu
node_version: 14
node_version: lts/-2

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
with: {sdk: stable}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with: {node-version: "${{ matrix.node_version }}"}

- name: Check out Dart Sass
Expand Down Expand Up @@ -144,10 +140,10 @@ jobs:
needs: [static_analysis, tests, sass_spec]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
node-version: 'lts/*'
check-latest: true
registry-url: 'https://registry.npmjs.org'
- run: npm install
Expand Down
13 changes: 7 additions & 6 deletions lib/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ export const compileAsync = sass.compileAsync;
export const compileString = sass.compileString;
export const compileStringAsync = sass.compileStringAsync;
export const Logger = sass.Logger;
export const CalculationInterpolation = sass.CalculationInterpolation
export const CalculationOperation = sass.CalculationOperation
export const CalculationOperator = sass.CalculationOperator
export const CalculationInterpolation = sass.CalculationInterpolation;
export const CalculationOperation = sass.CalculationOperation;
export const CalculationOperator = sass.CalculationOperator;
export const SassArgumentList = sass.SassArgumentList;
export const SassBoolean = sass.SassBoolean;
export const SassCalculation = sass.SassCalculation
export const SassCalculation = sass.SassCalculation;
export const SassColor = sass.SassColor;
export const SassFunction = sass.SassFunction;
export const SassMixin = sass.SassMixin;
Expand Down Expand Up @@ -39,8 +39,9 @@ function defaultExportDeprecation() {
if (printedDefaultExportDeprecation) return;
printedDefaultExportDeprecation = true;
console.error(
"`import sass from 'sass'` is deprecated.\n" +
"Please use `import * as sass from 'sass'` instead.");
"`import sass from 'sass'` is deprecated.\n" +
"Please use `import * as sass from 'sass'` instead."
);
}

export default {
Expand Down
4 changes: 3 additions & 1 deletion lib/src/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ describe('utils', () => {
describe('pathToUrlString', () => {
it('encode relative path like `pathToFileURL`', () => {
const baseURL = pathToFileURL('').toString();
for (let i = 0; i < 128; i++) {
// Skip charcodes 0-32 to work around Node trailing whitespace regression:
// https://github.com/nodejs/node/issues/51167
for (let i = 33; i < 128; i++) {
const char = String.fromCharCode(i);
const filename = `${i}-${char}`;
expect(pathToUrlString(filename)).toEqual(
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"dist/**/*"
],
"engines": {
"node": ">=14.0.0"
"node": ">=16.0.0"
},
"scripts": {
"init": "ts-node ./tool/init.ts",
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"resolveJsonModule": true,
"rootDir": ".",
"useUnknownInCatchVariables": false,
"resolveJsonModule": true,
"declaration": false,
"lib": ["DOM"]
},
Expand Down

0 comments on commit 7c0f559

Please sign in to comment.