Skip to content

Commit

Permalink
Update dependency @ota-meshi/eslint-plugin to ^0.11.0 (#37)
Browse files Browse the repository at this point in the history
* Update dependency @ota-meshi/eslint-plugin to ^0.11.0

* format

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
  • Loading branch information
renovate[bot] and ota-meshi committed Jul 1, 2022
1 parent 022246d commit 1e7c6fd
Show file tree
Hide file tree
Showing 26 changed files with 412 additions and 425 deletions.
26 changes: 13 additions & 13 deletions .eslintrc.js
@@ -1,15 +1,15 @@
"use strict"
"use strict";

module.exports = {
parserOptions: {
sourceType: "script",
ecmaVersion: 2020,
},
extends: [
"plugin:@ota-meshi/recommended",
"plugin:@ota-meshi/+node",
"plugin:@ota-meshi/+json",
"plugin:@ota-meshi/+yaml",
"plugin:@ota-meshi/+prettier",
],
}
parserOptions: {
sourceType: "script",
ecmaVersion: 2020,
},
extends: [
"plugin:@ota-meshi/recommended",
"plugin:@ota-meshi/+node",
"plugin:@ota-meshi/+json",
"plugin:@ota-meshi/+yaml",
"plugin:@ota-meshi/+prettier",
],
};
92 changes: 46 additions & 46 deletions .github/workflows/NodeCI.yml
@@ -1,51 +1,51 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install Packages
run: npm i --legacy-peer-deps
- name: Lint
run: npm run lint
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Packages
run: npm i --legacy-peer-deps
- name: Test
run: npm test
test-old-vers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
- name: Downgrade Packages
run: |
npm install --save-exact stylelint@14.0.0 --legacy-peer-deps
npm install --save-exact stylelint-config-recommended@6.0.0 --legacy-peer-deps
npx rimraf node_modules
- name: Install Packages
run: npm i --legacy-peer-deps
- name: Test
run: npm test
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install Packages
run: npm i --legacy-peer-deps
- name: Lint
run: npm run lint
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Packages
run: npm i --legacy-peer-deps
- name: Test
run: npm test
test-old-vers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
- name: Downgrade Packages
run: |
npm install --save-exact stylelint@14.0.0 --legacy-peer-deps
npm install --save-exact stylelint-config-recommended@6.0.0 --legacy-peer-deps
npx rimraf node_modules
- name: Install Packages
run: npm i --legacy-peer-deps
- name: Test
run: npm test
46 changes: 23 additions & 23 deletions .github/workflows/NpmPublish.yml
@@ -1,26 +1,26 @@
name: publish
on:
push:
tags:
- "*"
push:
tags:
- "*"
jobs:
release:
name: check version, and release
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup Node
uses: actions/setup-node@v3
with:
registry-url: "https://registry.npmjs.org"
- name: Install Packages
run: npm i --legacy-peer-deps
- name: test
run: npm run test
- name: check can npm-publish
run: npx can-npm-publish
- name: release
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
release:
name: check version, and release
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup Node
uses: actions/setup-node@v3
with:
registry-url: "https://registry.npmjs.org"
- name: Install Packages
run: npm i --legacy-peer-deps
- name: test
run: npm run test
- name: check can npm-publish
run: npx can-npm-publish
- name: release
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 1 addition & 7 deletions .vscode/settings.json
@@ -1,9 +1,3 @@
{
"eslint.validate": [
"javascript",
"javascriptreact",
"json",
"jsonc",
"yaml"
]
"eslint.validate": ["javascript", "javascriptreact", "json", "jsonc", "yaml"]
}
80 changes: 39 additions & 41 deletions lib/get-module-version.js
@@ -1,57 +1,55 @@
"use strict"
"use strict";

const path = require("path")
const path = require("path");

/**
* Gets the module version from package name
*/
module.exports = function getModuleVersion(...moduleNames) {
const packageName = moduleNames.pop()
const packageName = moduleNames.pop();

let ownerModuleRootPath = process.cwd()
for (const ownerNames of moduleNames) {
ownerModuleRootPath =
getModuleRootPath(ownerNames, ownerModuleRootPath) ||
ownerModuleRootPath
}
try {
const m = require("module")
const relativeTo = path.join(ownerModuleRootPath, "__placeholder__.js")
// eslint-disable-next-line node/no-unsupported-features/node-builtins -- ignore
return m.createRequire(relativeTo)(`${packageName}/package.json`)
.version
} catch {
// ignore
}
try {
return require(`${packageName}/package.json`).version
} catch {
// ignore
}
let ownerModuleRootPath = process.cwd();
for (const ownerNames of moduleNames) {
ownerModuleRootPath =
getModuleRootPath(ownerNames, ownerModuleRootPath) || ownerModuleRootPath;
}
try {
const m = require("module");
const relativeTo = path.join(ownerModuleRootPath, "__placeholder__.js");
// eslint-disable-next-line node/no-unsupported-features/node-builtins -- ignore
return m.createRequire(relativeTo)(`${packageName}/package.json`).version;
} catch {
// ignore
}
try {
return require(`${packageName}/package.json`).version;
} catch {
// ignore
}

return null
}
return null;
};

/**
* Get module root path
*/
function getModuleRootPath(packageName, ownerModuleRootPath) {
try {
const m = require("module")
const relativeTo = path.join(ownerModuleRootPath, "__placeholder__.js")
try {
const m = require("module");
const relativeTo = path.join(ownerModuleRootPath, "__placeholder__.js");

return path.dirname(
// eslint-disable-next-line node/no-unsupported-features/node-builtins -- ignore
m.createRequire(relativeTo).resolve(`${packageName}/package.json`),
)
} catch {
// ignore
}
try {
return path.dirname(require.resolve(`${packageName}/package.json`))
} catch {
// ignore
}
return path.dirname(
// eslint-disable-next-line node/no-unsupported-features/node-builtins -- ignore
m.createRequire(relativeTo).resolve(`${packageName}/package.json`)
);
} catch {
// ignore
}
try {
return path.dirname(require.resolve(`${packageName}/package.json`));
} catch {
// ignore
}

return null
return null;
}
18 changes: 9 additions & 9 deletions lib/index.js
@@ -1,11 +1,11 @@
"use strict"
"use strict";

module.exports = {
overrides: [
{
files: ["*.vue", "**/*.vue"],
extends: ["stylelint-config-recommended", "stylelint-config-html"],
rules: require("./vue-specific-rules"),
},
],
}
overrides: [
{
files: ["*.vue", "**/*.vue"],
extends: ["stylelint-config-recommended", "stylelint-config-html"],
rules: require("./vue-specific-rules"),
},
],
};
12 changes: 5 additions & 7 deletions lib/vue-specific-rules-for-scss.js
@@ -1,10 +1,8 @@
"use strict"
"use strict";

const baseRules = require("./vue-specific-rules")
const baseRules = require("./vue-specific-rules");

module.exports = {
...baseRules,
...(baseRules["function-no-unknown"]
? { "function-no-unknown": null }
: {}),
}
...baseRules,
...(baseRules["function-no-unknown"] ? { "function-no-unknown": null } : {}),
};
52 changes: 26 additions & 26 deletions lib/vue-specific-rules.js
@@ -1,29 +1,29 @@
"use strict"
"use strict";

const getModuleVersion = require("./get-module-version")
const semver = require("semver")
const stylelintVersion = getModuleVersion("stylelint") || "14.5.0"
const getModuleVersion = require("./get-module-version");
const semver = require("semver");
const stylelintVersion = getModuleVersion("stylelint") || "14.5.0";

module.exports = {
"selector-pseudo-class-no-unknown": [
true,
{
ignorePseudoClasses: ["deep", "global"],
},
],
"selector-pseudo-element-no-unknown": [
true,
{
ignorePseudoElements: ["v-deep", "v-global", "v-slotted"],
},
],
...(semver.gte(stylelintVersion, "14.5.0")
? {
"function-no-unknown": [true, { ignoreFunctions: ["v-bind"] }],
}
: semver.gte(stylelintVersion, "14.4.0")
? {
"function-no-unknown": null,
}
: {}),
}
"selector-pseudo-class-no-unknown": [
true,
{
ignorePseudoClasses: ["deep", "global"],
},
],
"selector-pseudo-element-no-unknown": [
true,
{
ignorePseudoElements: ["v-deep", "v-global", "v-slotted"],
},
],
...(semver.gte(stylelintVersion, "14.5.0")
? {
"function-no-unknown": [true, { ignoreFunctions: ["v-bind"] }],
}
: semver.gte(stylelintVersion, "14.4.0")
? {
"function-no-unknown": null,
}
: {}),
};

0 comments on commit 1e7c6fd

Please sign in to comment.