Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eslint9 private test #56

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/E2E integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
continue-on-error: true

- name: Upload eslint results as artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: eslint-result
path: ${{env.PROJECT}}/eslint-result-${{ matrix.os }}-${{github.run_id}}.sarif
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/node-version-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [12.x, 14.x, 16.x]
os: [windows-latest]
node-version: [20.x]

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
node-version: 20
- run: npm i
- run: npm test

Expand All @@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2.1.4
with:
node-version: 14
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm i
- run: npm publish
Expand Down
8 changes: 4 additions & 4 deletions lib/ast-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ module.exports = {
hasFullTypeInformation(context) {
var hasFullTypeInformation = (
context &&
this.isTypeScriptParserServices(context.parserServices) &&
context.parserServices.hasFullTypeInformation === true
this.isTypeScriptParserServices(context.sourceCode.parserServices) &&
context.sourceCode.parserServices.program
);
return hasFullTypeInformation;
},
getFullTypeChecker(context) {
return this.hasFullTypeInformation(context) ? context.parserServices.program.getTypeChecker() : null;
return this.hasFullTypeInformation(context) ? context.sourceCode.parserServices.program.getTypeChecker() : null;
},
getNodeTypeAsString(fullTypeChecker, node, context) {
if (fullTypeChecker && node) {
const tsNode = context.parserServices.esTreeNodeToTSNodeMap.get(node);
const tsNode = context.sourceCode.parserServices.esTreeNodeToTSNodeMap.get(node);
const tsType = fullTypeChecker.getTypeAtLocation(tsNode);
const type = fullTypeChecker.typeToString(tsType);
return type;
Expand Down
3 changes: 3 additions & 0 deletions lib/rules/no-cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"use strict";

const astUtils = require("../ast-utils");
const ESLintUtils = require("@typescript-eslint/utils").ESLintUtils;

//------------------------------------------------------------------------------
// Rule Definition
Expand All @@ -29,8 +30,10 @@ module.exports = {
},
create: function (context) {
const fullTypeChecker = astUtils.getFullTypeChecker(context);
fullTypeChecker && console.log("config1: " + JSON.stringify(ESLintUtils.getParserServices(context).program.getCompilerOptions()));
return {
"MemberExpression[property.name='cookie']"(node) {
fullTypeChecker && console.log("config2: " + JSON.stringify(ESLintUtils.getParserServices(context).program.getCompilerOptions()));
if (astUtils.isDocumentObject(node.object, context, fullTypeChecker)) {
context.report({
node: node,
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-postmessage-star-origin.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = {

// Check that object type is Window when full type information is available
if (fullTypeChecker) {
const tsNode = context.parserServices.esTreeNodeToTSNodeMap.get(node.callee.object);
const tsNode = context.sourceCode.parserServices.esTreeNodeToTSNodeMap.get(node.callee.object);
const tsType = fullTypeChecker.getTypeAtLocation(tsNode);
const type = fullTypeChecker.typeToString(tsType);
if (type !== "any" && type !== "Window") {
Expand Down
Loading
Loading